├── .gitignore ├── GNU_GPL.txt ├── README.md ├── build.xml ├── configfiles ├── FeaturesThatAvoidBiasInRenaissanceMusictConfigs.txt └── jSymbolicDefaultConfigs.txt ├── jSymbolicDefaultConfigs.txt ├── manifest.mf ├── manual ├── api_files │ ├── Bach J S - Cello Suite No 1 Prelude.mid │ ├── Buxtehude - Herr Jesu Christ, ich weiss gar wohl.mid │ ├── ExtractedFeatureValues.arff │ ├── ExtractedFeatureValues.csv │ ├── ExtractedFeatureValues.xml │ ├── FeatureDefinitions.xml │ ├── ProcessingTranscript.txt │ ├── api.html │ └── jSymbolicApiDemo.java ├── classstructure_files │ └── classstructure.html ├── commandline_files │ └── commandline.html ├── configuration_files │ └── configuration.html ├── contactinfo_files │ └── contactinfo.html ├── extendingsoftware_files │ └── extendingsoftware.html ├── featureexplanations_files │ ├── Forgot_About_Dre.gif │ ├── Four_Seasons.gif │ ├── I_Wanna_Be_Sedated.gif │ ├── Round_Midnight.gif │ ├── Schoenberg.gif │ ├── Sophisticated_Lady.gif │ ├── featureexplanations.html │ ├── featureschordsandverticalintervals.html │ ├── featuresdynamics.html │ ├── featuresinstrumentation.html │ ├── featuresmeispecific.html │ ├── featuresmelodicintervals.html │ ├── featuresoverallpitchstatistics.html │ ├── featuresrhythm.html │ └── featurestexture.html ├── gui_files │ ├── gui.html │ └── jSymbolicScreenShot.jpg ├── home.html ├── home_files │ ├── CIRMMT_Logo.gif │ ├── FQRSC_Logo.jpg │ ├── Marianopolis_Logo.gif │ ├── SSHRC_Logo.jpg │ ├── Schulich_McGill_Logo.gif │ ├── Schulich_McGill_Logo.jpg │ ├── contents.html │ ├── jMIR_logo.gif │ └── splash.html ├── installation_files │ └── installation.html ├── introduction_files │ └── introduction.html ├── licensing_files │ └── licensing.html ├── processingsequence_files │ └── processingsequence.html └── versionhistory_files │ └── versionhistory.html ├── nbproject ├── build-impl.xml ├── genfiles.properties ├── private │ ├── config.properties │ ├── private.properties │ └── private.xml ├── project.properties └── project.xml ├── src └── jsymbolic2 │ ├── Main.java │ ├── api │ ├── JsymbolicProcessor.java │ └── deprecated │ │ ├── JsymbolicData.java │ │ └── JsymbolicProcessorDeprecated.java │ ├── commandline │ ├── CommandLineSwitchEnum.java │ └── CommandLineUtilities.java │ ├── configurationfile │ ├── ConfigFileCompleteData.java │ ├── ConfigFileInputFilePaths.java │ ├── ConfigFileOutputFilePaths.java │ ├── ConfigFileWindowingAndOutputFormatSettings.java │ ├── EnumOutputFileTypes.java │ ├── EnumSectionDividers.java │ ├── EnumWindowingAndOutputFormatSettings.java │ ├── ValidatorConfigFile.java │ ├── WriterConfigFile.java │ └── txtimplementation │ │ ├── ConfigFileFieldNameValuePair.java │ │ ├── EnumFieldValueDelimiter.java │ │ ├── EnumFileExtension.java │ │ ├── ValidatorConfigFileTxtImpl.java │ │ └── WriterConfigFileTxtImpl.java │ ├── features │ ├── dynamics │ │ ├── AverageNoteToNoteChangeInDynamics.java │ │ ├── DynamicRangeFeature.java │ │ ├── VariationOfDynamicsFeature.java │ │ └── VariationOfDynamicsInEachVoiceFeature.java │ ├── instrumentation │ │ ├── AcousticGuitarPrevalenceFeature.java │ │ ├── BrassPrevalenceFeature.java │ │ ├── ElectricGuitarPrevalenceFeature.java │ │ ├── ElectricInstrumentPrevalenceFeature.java │ │ ├── NotePrevalenceOfPitchedInstrumentsFeature.java │ │ ├── NotePrevalenceOfUnpitchedInstrumentsFeature.java │ │ ├── NumberOfPitchedInstrumentsFeature.java │ │ ├── NumberOfUnpitchedInstrumentsFeature.java │ │ ├── OrchestralStringsPrevalenceFeature.java │ │ ├── PitchedInstrumentsPresentFeature.java │ │ ├── SaxophonePrevalenceFeature.java │ │ ├── StringEnsemblePrevalenceFeature.java │ │ ├── StringKeyboardPrevalenceFeature.java │ │ ├── TimePrevalenceOfPitchedInstrumentsFeature.java │ │ ├── UnpitchedInstrumentsPresentFeature.java │ │ ├── UnpitchedPercussionInstrumentPrevalenceFeature.java │ │ ├── VariabilityOfNotePrevalenceOfPitchedInstrumentsFeature.java │ │ ├── VariabilityOfNotePrevalenceOfUnpitchedInstrumentsFeature.java │ │ ├── ViolinPrevalenceFeature.java │ │ └── WoodwindsPrevalenceFeature.java │ ├── meispecific │ │ ├── NumberOfGraceNotesMeiFeature.java │ │ └── NumberOfSlursMeiFeature.java │ ├── melodicintervals │ │ ├── AmountOfArpeggiationFeature.java │ │ ├── AverageIntervalSpannedByMelodicArcs.java │ │ ├── AverageLengthOfMelodicArcsFeature.java │ │ ├── ChromaticMotionFeature.java │ │ ├── DirectionOfMelodicMotionFeature.java │ │ ├── DistanceBetweenMostPrevalentMelodicIntervalsFeature.java │ │ ├── MeanMelodicIntervalFeature.java │ │ ├── MelodicEmbellishmentsFeature.java │ │ ├── MelodicIntervalHistogramFeature.java │ │ ├── MelodicLargeIntervalsFeature.java │ │ ├── MelodicOctavesFeature.java │ │ ├── MelodicPerfectFifthsFeature.java │ │ ├── MelodicPerfectFourthsFeature.java │ │ ├── MelodicPitchVarietyFeature.java │ │ ├── MelodicSeventhsFeature.java │ │ ├── MelodicSixthsFeature.java │ │ ├── MelodicThirdsFeature.java │ │ ├── MelodicTritonesFeature.java │ │ ├── MinorMajorMelodicThirdlRatioFeature.java │ │ ├── MostCommonMelodicIntervalFeature.java │ │ ├── NumberOfCommonMelodicIntervalsFeature.java │ │ ├── PrevalenceOfMostCommonMelodicInterval.java │ │ ├── RelativePrevalenceOfMostCommonMelodicIntervals.java │ │ ├── RepeatedNotesFeature.java │ │ └── StepwiseMotionFeature.java │ ├── pitchstatistics │ │ ├── AverageRangeOfGlissandosFeature.java │ │ ├── BasicPitchHistogramFeature.java │ │ ├── DominantSpreadFeature.java │ │ ├── FirstPitchClassFeature.java │ │ ├── FirstPitchFeature.java │ │ ├── FoldedFifthsPitchClassHistogramFeature.java │ │ ├── GlissandoPrevalenceFeature.java │ │ ├── ImportanceOfBassRegisterFeature.java │ │ ├── ImportanceOfHighRegisterFeature.java │ │ ├── ImportanceOfMiddleRegisterFeature.java │ │ ├── IntervalBetweenMostPrevalentPitchClassesFeature.java │ │ ├── IntervalBetweenMostPrevalenttPitchesFeature.java │ │ ├── LastPitchClassFeature.java │ │ ├── LastPitchFeature.java │ │ ├── MajorOrMinorFeature.java │ │ ├── MeanPitchClassFeature.java │ │ ├── MeanPitchFeature.java │ │ ├── MicrotonePrevalenceFeature.java │ │ ├── MostCommonPitchClassFeature.java │ │ ├── MostCommonPitchFeature.java │ │ ├── NumberOfCommonPitchClassesFeature.java │ │ ├── NumberOfCommonPitchesFeature.java │ │ ├── NumberOfPitchClassesFeature.java │ │ ├── NumberOfPitchesFeature.java │ │ ├── PitchClassHistogramFeature.java │ │ ├── PitchClassKurtosisAfterFoldingFeature.java │ │ ├── PitchClassKurtosisFeature.java │ │ ├── PitchClassSkewnessAfterFoldingFeature.java │ │ ├── PitchClassSkewnessFeature.java │ │ ├── PitchClassVariabilityAfterFoldingFeature.java │ │ ├── PitchClassVariabilityFeature.java │ │ ├── PitchKurtosisFeature.java │ │ ├── PitchSkewnessFeature.java │ │ ├── PitchVariabilityFeature.java │ │ ├── PrevalenceOfMostCommonPitchClassFeature.java │ │ ├── PrevalenceOfMostCommonPitchFeature.java │ │ ├── RangeFeature.java │ │ ├── RelativePrevalenceOfTopPitchClassesFeature.java │ │ ├── RelativePrevalenceOfTopPitchesFeature.java │ │ ├── StrongTonalCentresFeature.java │ │ └── VibratoPrevalenceFeature.java │ ├── rhythm │ │ ├── AmountOfStaccatoFeature.java │ │ ├── AverageNoteDurationFeature.java │ │ ├── AverageRestFractionAcrossVoicesFeature.java │ │ ├── AverageTimeBetweenAttacksFeature.java │ │ ├── AverageTimeBetweenAttacksForEachVoiceFeature.java │ │ ├── AverageVariabilityOfTimeBetweenAttacksForEachVoiceFeature.java │ │ ├── BeatHistogramFeature.java │ │ ├── BeatHistogramTempoStandardizedFeature.java │ │ ├── CombinedStrengthOfTwoStrongestRhythmicPulsesFeature.java │ │ ├── CombinedStrengthOfTwoStrongestRhythmicPulsesTempoStandardizedFeature.java │ │ ├── CompleteRestsFractionFeature.java │ │ ├── ComplexInitialMeterFeature.java │ │ ├── CompoundInitialMeterFeature.java │ │ ├── DifferenceBetweenMostCommonRhythmicValuesFeature.java │ │ ├── DupleInitialMeterFeature.java │ │ ├── DurationInSecondsFeature.java │ │ ├── HarmonicityOfTwoStrongestRhythmicPulsesFeature.java │ │ ├── HarmonicityOfTwoStrongestRhythmicPulsesTempoStandardizedFeature.java │ │ ├── InitialTempoFeature.java │ │ ├── InitialTimeSignatureFeature.java │ │ ├── LongestCompleteRestFeature.java │ │ ├── LongestPartialRestFeature.java │ │ ├── LongestRhythmicValueFeature.java │ │ ├── MaximumNoteDurationFeature.java │ │ ├── MeanCompleteRestDurationFeature.java │ │ ├── MeanPartialRestDurationFeature.java │ │ ├── MeanRhythmicValueFeature.java │ │ ├── MeanRhythmicValueOffsetFeature.java │ │ ├── MeanRhythmicValueRunLengthFeature.java │ │ ├── MeanTempoFeature.java │ │ ├── MedianCompleteRestDurationFeature.java │ │ ├── MedianPartialRestDurationFeature.java │ │ ├── MedianRhythmicValueOffsetFeature.java │ │ ├── MedianRhythmicValueRunLengthFeature.java │ │ ├── MetricalDiversityFeature.java │ │ ├── MinimumNoteDurationFeature.java │ │ ├── MostCommonRhythmicValueFeature.java │ │ ├── NoteDensityFeature.java │ │ ├── NoteDensityPerQuarterNoteFeature.java │ │ ├── NoteDensityPerQuarterNotePerVoiceFeature.java │ │ ├── NoteDensityPerQuarterNoteVariabilityFeature.java │ │ ├── NoteDensityVariabilityFeature.java │ │ ├── NumberOfCommonRhythmicValuesPresentFeature.java │ │ ├── NumberOfDifferentRhythmicValuesPresentFeature.java │ │ ├── NumberOfModerateRhythmicPulsesFeature.java │ │ ├── NumberOfModerateRhythmicPulsesTempoStandardizedFeature.java │ │ ├── NumberOfRelativelyStrongRhythmicPulsesFeature.java │ │ ├── NumberOfRelativelyStrongRhythmicPulsesTempoStandardizedFeature.java │ │ ├── NumberOfStrongRhythmicPulsesFeature.java │ │ ├── NumberOfStrongRhythmicPulsesTempoStandardizedFeature.java │ │ ├── PartialRestsFractionFeature.java │ │ ├── PolyrhythmsFeature.java │ │ ├── PolyrhythmsTempoStandardizedFeature.java │ │ ├── PrevalenceOfDottedNotesFeature.java │ │ ├── PrevalenceOfLongRhythmicValuesFeature.java │ │ ├── PrevalenceOfMediumRhythmicValuesFeature.java │ │ ├── PrevalenceOfMostCommonRhythmicValueFeature.java │ │ ├── PrevalenceOfShortRhythmicValuesFeature.java │ │ ├── PrevalenceOfVeryLongRhythmicValuesFeature.java │ │ ├── PrevalenceOfVeryShortRhythmicValuesFeature.java │ │ ├── QuadrupleInitialMeterFeature.java │ │ ├── RangeOfRhythmicValuesFeature.java │ │ ├── RelativePrevalenceOfMostCommonRhythmicValuesFeature.java │ │ ├── RhythmicLoosenessFeature.java │ │ ├── RhythmicLoosenessTempoStandardizedFeature.java │ │ ├── RhythmicValueHistogramFeature.java │ │ ├── RhythmicValueKurtosisFeature.java │ │ ├── RhythmicValueMedianRunLengthsHistogramFeature.java │ │ ├── RhythmicValueSkewnessFeature.java │ │ ├── RhythmicValueVariabilityFeature.java │ │ ├── RhythmicValueVariabilityInRunLengthsHistogramFeature.java │ │ ├── RhythmicVariabilityFeature.java │ │ ├── RhythmicVariabilityTempoStandardizedFeature.java │ │ ├── SecondStrongestRhythmicPulseFeature.java │ │ ├── SecondStrongestRhythmicPulseTempoStandardizedFeature.java │ │ ├── ShortestRhythmicValueFeature.java │ │ ├── SimpleInitialMeterFeature.java │ │ ├── StrengthOfSecondStrongestRhythmicPulseFeature.java │ │ ├── StrengthOfSecondStrongestRhythmicPulseTempoStandardizedFeature.java │ │ ├── StrengthOfStrongestRhythmicPulseFeature.java │ │ ├── StrengthOfStrongestRhythmicPulseTempoStandardizedFeature.java │ │ ├── StrengthRatioOfTwoStrongestRhythmicPulsesFeature.java │ │ ├── StrengthRatioOfTwoStrongestRhythmicPulsesTempoStandardizedFeature.java │ │ ├── StrongestRhythmicPulseFeature.java │ │ ├── StrongestRhythmicPulseTempoStandardizedFeature.java │ │ ├── TempoVariabilityFeature.java │ │ ├── TotalNumberOfNotesFeature.java │ │ ├── TripleInitialMeterFeature.java │ │ ├── VariabilityAcrossVoicesOfCombinedRestsFeature.java │ │ ├── VariabilityInRhythmicValueRunLengthsFeature.java │ │ ├── VariabilityOfCompleteRestDurationsFeature.java │ │ ├── VariabilityOfNoteDurationsFeature.java │ │ ├── VariabilityOfPartialRestDurationsFeature.java │ │ ├── VariabilityOfRhythmicValueOffsetsFeature.java │ │ └── VariabilityOfTimeBetweenAttacksFeature.java │ ├── texture │ │ ├── AverageNumberOfIndependentVoicesFeature.java │ │ ├── ContraryMotionFeature.java │ │ ├── ImportanceOfLoudestVoiceFeature.java │ │ ├── MaximumNumberOfIndependentVoicesFeature.java │ │ ├── ObliqueMotionFeature.java │ │ ├── ParallelFifthsFeature.java │ │ ├── ParallelMotionFeature.java │ │ ├── ParallelOctavesFeature.java │ │ ├── RelativeNoteDensityOfHighestLineFeature.java │ │ ├── RelativeNoteDurationsOfLowestLineFeature.java │ │ ├── RelativeRangeIsolationOfLoudestVoiceFeature.java │ │ ├── RelativeRangeOfHighestLineFeature.java │ │ ├── RelativeRangeOfLoudestVoiceFeature.java │ │ ├── RelativeSizeOfMelodicIntervalsInLowestLineFeature.java │ │ ├── SimilarMotionFeature.java │ │ ├── VariabilityOfNumberOfIndependentVoicesFeature.java │ │ ├── VariabilityOfVoiceSeparationFeature.java │ │ ├── VoiceEqualityDynamicsFeature.java │ │ ├── VoiceEqualityMelodicLeapsFeature.java │ │ ├── VoiceEqualityNoteDurationFeature.java │ │ ├── VoiceEqualityNumberOfNotesFeature.java │ │ ├── VoiceEqualityRangeFeature.java │ │ ├── VoiceOverlapFeature.java │ │ └── VoiceSeparationFeature.java │ └── verticalintervals │ │ ├── AverageNumberOfSimultaneousPitchClassesFeature.java │ │ ├── AverageNumberOfSimultaneousPitchesFeature.java │ │ ├── ChordDurationFeature.java │ │ ├── ChordTypeHistogramFeature.java │ │ ├── ComplexChordsFeature.java │ │ ├── DiminishedAndAugmentedTriadsFeature.java │ │ ├── DistanceBetweenTwoMostCommonVerticalIntervalsFeature.java │ │ ├── DominantSeventhChordsFeature.java │ │ ├── MinorMajorTriadRatioFeature.java │ │ ├── MostCommonVerticalIntervalFeature.java │ │ ├── NonStandardChordsFeature.java │ │ ├── PartialChordsFeature.java │ │ ├── PerfectVerticalIntervalsFeature.java │ │ ├── PrevalenceOfMostCommonVerticalIntervalFeature.java │ │ ├── PrevalenceOfSecondMostCommonVerticalIntervalFeature.java │ │ ├── PrevalenceRatioOfTwoMostCommonVerticalIntervalsFeature.java │ │ ├── SecondMostCommonVerticalIntervalFeature.java │ │ ├── SeventhChordsFeature.java │ │ ├── StandardTriadsFeature.java │ │ ├── VariabilityOfNumberOfSimultaneousPitchClassesFeature.java │ │ ├── VariabilityOfNumberOfSimultaneousPitchesFeature.java │ │ ├── VerticalDissonanceRatioFeature.java │ │ ├── VerticalIntervalHistogramFeature.java │ │ ├── VerticalMajorThirdPrevalenceFeature.java │ │ ├── VerticalMinorSecondsFeature.java │ │ ├── VerticalMinorThirdPrevalenceFeature.java │ │ ├── VerticalOctavesFeature.java │ │ ├── VerticalPerfectFifthsFeature.java │ │ ├── VerticalPerfectFourthsFeature.java │ │ ├── VerticalSeventhsFeature.java │ │ ├── VerticalSixthsFeature.java │ │ ├── VerticalThirdsFeature.java │ │ ├── VerticalTritonesFeature.java │ │ ├── VerticalUnisonsFeature.java │ │ └── WrappedVerticalIntervalHistogramFeature.java │ ├── featureutils │ ├── ChordTypeEnum.java │ ├── CollectedNoteInfo.java │ ├── FeatureExtractorAccess.java │ ├── MEIFeatureExtractor.java │ ├── MIDIFeatureExtractor.java │ └── NoteInfo.java │ ├── gui │ ├── ExtractionConfigurationsPanel.java │ ├── FeatureSelectorPanel.java │ ├── FeatureSelectorTableModel.java │ ├── MusicFileSelectorPanel.java │ ├── OuterFrame.java │ ├── SymbolicMusicFile.java │ └── SymbolicMusicFilesTableModel.java │ └── processing │ ├── AceXmlConverter.java │ ├── FeatureExtractionJobProcessor.java │ ├── MIDIFeatureProcessor.java │ ├── MIDIIntermediateRepresentations.java │ ├── MIDIReporter.java │ ├── MusicFilter.java │ ├── SymbolicMusicFileUtilities.java │ └── UserFeedbackGenerator.java ├── test └── jsymbolic2 │ ├── api │ ├── jSymbolicProcessorTest.java │ └── resources │ │ ├── Chopin_Mazurka.midi │ │ ├── Saint-Saens_LeCarnevalDesAnimmaux.mei │ │ ├── sampleConfigConvert.txt │ │ └── sampleConfiguration.txt │ ├── configuration │ ├── ConfigurationFileDataTest.java │ ├── resources │ │ ├── invalidConfiguration.txt │ │ ├── invalidConfiguration.txt~ │ │ ├── invalidFileConfiguration.txt~ │ │ ├── invalidOptionConfiguration.txt~ │ │ ├── noIOConfiguration.txt │ │ ├── noIOConfiguration.txt~ │ │ ├── sampleConfiguration.txt │ │ ├── sampleConfiguration.txt~ │ │ ├── sampleConfiguration2.txt │ │ └── sampleConfiguration2.txt~ │ └── txtimplementation │ │ ├── ConfigurationFileValidatorTxtImplTest.java │ │ ├── ConfigurationFileWriterTxtImplTest.java │ │ └── ConfigurationOptionsEnumTest.java │ ├── features │ ├── AcousticGuitarFractionFeatureTest.java │ ├── AverageNumberOfSimultaneousPitchClassesFeatureTest.java │ ├── AverageRestDurationPerVoiceFeatureTest.java │ ├── AverageVariabilityOfRestDurationsAcrossVoicesFeatureTest.java │ ├── ChordDurationFeatureTest.java │ ├── ChordTypesEnumTest.java │ ├── ChordTypesHistogramFeatureTest.java │ ├── ComplexChordsFeatureTest.java │ ├── DiminishedAndAugmentedTriadsFeatureTest.java │ ├── DistanceBetweenTwoMostCommonVerticalIntervalsFeatureTest.java │ ├── DominantSeventhChordsFeatureTest.java │ ├── EmbellishmentFeatureTest.java │ ├── IncidenceOfCompleteRestsFeatureTest.java │ ├── MaximumCompleteRestDurationFeatureTest.java │ ├── MelodicPitchVarietyFeatureTest.java │ ├── MinorMajorTriadRatioFeatureTest.java │ ├── MostCommonVerticalIntervalFeatureTest.java │ ├── NonStandardChordsFeatureTest.java │ ├── NoteDensityVariabilityFeatureTest.java │ ├── NumberOfGraceNotesFeatureTest.java │ ├── NumberOfSlurNotesFeatureTest.java │ ├── ParallelMotionFeatureTest.java │ ├── PartialChordsFeatureTest.java │ ├── PerfectVerticalIntervalsFeatureTest.java │ ├── PrevalenceOfMicroTonesFeatureTest.java │ ├── PrevalenceOfMostCommonVerticalIntervalFeatureTest.java │ ├── PrevalenceOfSecondMostCommonVerticalIntervalFeatureTest.java │ ├── RatioOfPrevalenceOfTwoMostCommonVerticalIntervalsFeatureTest.java │ ├── RelativeRangeIsolationOfLoudestVoiceFeatureTest.java │ ├── SecondMostCommonVerticalIntervalFeatureTest.java │ ├── SeventhChordsFeatureTest.java │ ├── StandardTriadsFeatureTest.java │ ├── UnisonsFeatureTest.java │ ├── VariabilityOfNumberOfSimultaneousPitchClassesFeatureTest.java │ ├── VerticalDissonanceRatioFeatureTest.java │ ├── VerticalFifthsFeatureTest.java │ ├── VerticalIntervalWrappedHistogramFeatureTest.java │ ├── VerticalIntervalsFeatureTest.java │ ├── VerticalMajorThirdPrevalenceFeatureTest.java │ ├── VerticalMinorSecondsFeatureTest.java │ ├── VerticalMinorThirdPrevalenceFeatureTest.java │ ├── VerticalOctavesFeatureTest.java │ ├── VerticalThirdsFeatureTest.java │ ├── VerticalTritonesFeatureTest.java │ ├── VoiceOverlapFeatureTest.java │ └── resources │ │ ├── Britten_-_Serenade_prologue.midi │ │ └── Saint-Saens_LeCarnevalDesAnimmaux.mei │ └── processing │ ├── AceToArffAndCsvTest.java │ ├── FileValidatorTest.java │ ├── MIDIIntermediateRepresentationsTest.java │ └── resources │ ├── feature_values.arff │ ├── feature_values.csv │ ├── feature_values.xml │ ├── feature_values_1.arff │ ├── feature_values_1.csv │ ├── feature_values_noxml │ ├── feature_values_noxml.arff │ └── feature_values_noxml.csv └── tutorial ├── configurationfiles.html ├── contents.html ├── doingsomerealresearch.html ├── examiningfeatures.html ├── finalwords.html ├── home.html ├── installation.html ├── introduction.html ├── jSymbolicTutorialWorkingFiles.zip ├── jsymbolicbasics.html ├── jsymbolicbitsandpieces.html ├── portugueseresearch.html ├── runningjsymbolic.html ├── selectingsymbolicmusic.html ├── trainingamodelandusingit.html ├── usingweka.html └── workingwithfeatures.html /.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /dist/ -------------------------------------------------------------------------------- /manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /manual/api_files/Bach J S - Cello Suite No 1 Prelude.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/api_files/Bach J S - Cello Suite No 1 Prelude.mid -------------------------------------------------------------------------------- /manual/api_files/Buxtehude - Herr Jesu Christ, ich weiss gar wohl.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/api_files/Buxtehude - Herr Jesu Christ, ich weiss gar wohl.mid -------------------------------------------------------------------------------- /manual/contactinfo_files/contactinfo.html: -------------------------------------------------------------------------------- 1 | 2 | Contact Information 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
Contact Information
13 | 14 |

jSymbolic is part of the jMIR music classification project hosted on SourceForge (jmir.sourceforge.net).

15 | 16 | 17 |

Detailed information on jSymbolic 1.0, the first release version of the software, is available in Chapter 4 of Cory McKay's disseration. Please contact Cory McKay at cory.mckay@mail.mcgill.ca with any bug reports or questions.

18 | 19 |

20 |
21 |

-top of page-

22 | 23 | -------------------------------------------------------------------------------- /manual/featureexplanations_files/Forgot_About_Dre.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/featureexplanations_files/Forgot_About_Dre.gif -------------------------------------------------------------------------------- /manual/featureexplanations_files/Four_Seasons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/featureexplanations_files/Four_Seasons.gif -------------------------------------------------------------------------------- /manual/featureexplanations_files/I_Wanna_Be_Sedated.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/featureexplanations_files/I_Wanna_Be_Sedated.gif -------------------------------------------------------------------------------- /manual/featureexplanations_files/Round_Midnight.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/featureexplanations_files/Round_Midnight.gif -------------------------------------------------------------------------------- /manual/featureexplanations_files/Schoenberg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/featureexplanations_files/Schoenberg.gif -------------------------------------------------------------------------------- /manual/featureexplanations_files/Sophisticated_Lady.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/featureexplanations_files/Sophisticated_Lady.gif -------------------------------------------------------------------------------- /manual/featureexplanations_files/featureexplanations.html: -------------------------------------------------------------------------------- 1 | 2 | Feature Explanations 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
Feature Explanations
13 | 14 |

The manual pages comprising this section describe all of the features that jSymbolic extracts. The features are divided into the following groups:

15 | 25 |

These manual pages were originally drawn largely from Chapter 4 of Cory McKay's dissertation, although many improvements and clarifications have been made since then, and many new features have been added.

26 |

Note that, although many of the feature descriptions use MIDI-specific terminology, they are all compatible with alternative formats that jSymbolic can extract features from, such as MEI. Part of what jSybmolic does when encountering MEI files is to convert them to MIDI data in a very rich way, such that all the MIDI-related features can be extracted from them. MEI data that cannot be encoded as MIDI is maintained in a separate data pipeline, and features can be extracted from this pipeline as well (see the section on MEI-specific features).

27 |

If a feature cannot be calculated for whatever reason for a given piece of music, the default behavior is to save a value of -1 for one-dimensional features, and null for multi-dimensional features.

28 | 29 |

30 |
31 |

-top of page-

32 | 33 | -------------------------------------------------------------------------------- /manual/featureexplanations_files/featuresdynamics.html: -------------------------------------------------------------------------------- 1 | 2 | Feature Explanations: Dynamics 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
Feature Explanations: Dynamics
13 | 14 |

GENERAL NOTES

15 | 16 |

The ways in which musical dynamics are used in a piece can also be characteristic of different types of musical classes. Once again, however, this information is only rarely used in traditional analytical systems, and is generally notated only very coarsely in musical scores. Fortunately, MIDI velocity values make it possible to annotate dynamics much more precisely, even though MIDI encodings generated by score editing software admittedly generally fail to take full advantage of this.

17 | 18 |

One important point to consider with respect to MIDI dynamics is that, while MIDI velocities are generally used to indicate the strength with which notes are sounded, this is not the only way in which loudness is controlled. MIDI channel volume can also be changed independently. jSymbolic takes this into account by using the following formula to find loudness values used to calculate the features described in this sub-section:

19 | 20 |

loudness = note velocity x (channel volume / 127)

21 | 22 |

It should also be noted that all of the jSymbolic features related to dynamics use relative measures of loudness rather than absolute measures because the default volume and velocity values set by sequencers can vary.

23 | 24 |

JSYMBOLIC FEATURE CATALOGUE (DYNAMICS SECTION)

25 | 32 | 33 |
34 |

-top of page-

35 | 36 | -------------------------------------------------------------------------------- /manual/featureexplanations_files/featuresinstrumentation.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/featureexplanations_files/featuresinstrumentation.html -------------------------------------------------------------------------------- /manual/featureexplanations_files/featuresmeispecific.html: -------------------------------------------------------------------------------- 1 | 2 | Feature Explanations: MEI-Specific Features 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
Feature Explanations: MEI-Specific Features
13 | 14 |

GENERAL NOTES

15 | 16 |

There is certain information that cannot be encoded in MIDI files, due to limitations of the MIDI format. jSymbolic provides access to this data through a separate data pipeline, which can be accessed by MEI-specific features, such as the sample features listed below.

17 |

MEI-specific features rely on information that is available in MEI files, but cannot be encoded in MIDI files. These features should only be used when extracting features from a musical collection consisting exclusively of MEI files, as a feature set extracted from a mixture of MIDI and MEI files would be inconsistent if MEI-specific features are available for MEI instances but not for MIDI instances.

18 |

JSYMBOLIC FEATURE CATALOGUE (MEI-SPECIFIC FEATURES SECTION)

19 | 23 |

24 |
25 |

-top of page-

26 | 27 | -------------------------------------------------------------------------------- /manual/featureexplanations_files/featuresmelodicintervals.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/featureexplanations_files/featuresmelodicintervals.html -------------------------------------------------------------------------------- /manual/featureexplanations_files/featuresrhythm.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/featureexplanations_files/featuresrhythm.html -------------------------------------------------------------------------------- /manual/featureexplanations_files/featurestexture.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/featureexplanations_files/featurestexture.html -------------------------------------------------------------------------------- /manual/gui_files/jSymbolicScreenShot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/gui_files/jSymbolicScreenShot.jpg -------------------------------------------------------------------------------- /manual/home.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | jSymbolic Manual 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /manual/home_files/CIRMMT_Logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/home_files/CIRMMT_Logo.gif -------------------------------------------------------------------------------- /manual/home_files/FQRSC_Logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/home_files/FQRSC_Logo.jpg -------------------------------------------------------------------------------- /manual/home_files/Marianopolis_Logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/home_files/Marianopolis_Logo.gif -------------------------------------------------------------------------------- /manual/home_files/SSHRC_Logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/home_files/SSHRC_Logo.jpg -------------------------------------------------------------------------------- /manual/home_files/Schulich_McGill_Logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/home_files/Schulich_McGill_Logo.gif -------------------------------------------------------------------------------- /manual/home_files/Schulich_McGill_Logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/home_files/Schulich_McGill_Logo.jpg -------------------------------------------------------------------------------- /manual/home_files/contents.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Manual Contents 5 | 6 | 7 | 8 | CONTENTS 9 | 10 | 11 | 12 |

Home

13 | 14 |

Introduction

15 | 16 |

Installation

17 | 18 |

Using the Graphical User Interface

19 | 20 |

Using the Command Line Interface

21 | 22 |

Using the API

23 | 24 |

Configuration Settings File

25 | 26 |

Feature Explanations

27 | 28 | 38 | 39 |

Processing Sequence

40 | 41 |

Class Structure

42 | 43 |

Extending the Software

44 | 45 |

Licensing and Acknowledgements

46 | 47 |

Contact Information

48 | 49 |

Version History

50 | 51 |
52 | 53 | -------------------------------------------------------------------------------- /manual/home_files/jMIR_logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/home_files/jMIR_logo.gif -------------------------------------------------------------------------------- /manual/home_files/splash.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | jSymbolic 5 | 6 | 7 | 8 | 9 |
10 |

11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
jSymbolic 2.3
Cory McKay
CIRMMT, Marianopolis College and McGill University
Copyright (C) 2019 (GNU GPL)
27 |
28 |
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

jmir.sourceforge.net

39 |
40 | 41 |

42 |
43 | 44 | 45 | 46 | 47 | 48 | 49 |
50 |
51 | 52 |

53 |
54 | 55 | 56 | 57 |
58 | 59 | 60 | 61 | 62 |
63 |
64 | 65 | -------------------------------------------------------------------------------- /manual/licensing_files/licensing.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/manual/licensing_files/licensing.html -------------------------------------------------------------------------------- /nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=b34bd2fe 2 | build.xml.script.CRC32=7b902537 3 | build.xml.stylesheet.CRC32=8064a381@1.79.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=b34bd2fe 7 | nbproject/build-impl.xml.script.CRC32=679c4c47 8 | nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48 9 | -------------------------------------------------------------------------------- /nbproject/private/config.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/nbproject/private/config.properties -------------------------------------------------------------------------------- /nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=false 2 | do.depend=false 3 | do.jar=true 4 | javac.debug=true 5 | javadoc.preview=true 6 | user.properties.file=C:\\Users\\Cory\\AppData\\Roaming\\NetBeans\\8.1\\build.properties 7 | -------------------------------------------------------------------------------- /nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | jSymbolic2 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | ACE 17 | jar 18 | 19 | jar 20 | clean 21 | jar 22 | 23 | 24 | UtilityClasses 25 | jar 26 | 27 | jar 28 | clean 29 | jar 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/jsymbolic2/Main.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2; 2 | 3 | import jsymbolic2.commandline.CommandLineSwitchEnum; 4 | 5 | /** 6 | * The jSymbolic runnable class. See the README or manual for more details on jSymbolic. 7 | * 8 | * @author Cory McKay and Tristano Tenaglia 9 | */ 10 | public class Main 11 | { 12 | /* PUBLIC STATIC FINAL FIELDS ***************************************************************************/ 13 | 14 | 15 | /** 16 | * The name and version of this jSymbolic version. 17 | */ 18 | public static final String SOFTWARE_NAME_AND_VERSION = "jSymbolic 2.3"; 19 | 20 | /** 21 | * The string indicating licensing credit. 22 | */ 23 | public static final String YEAR_AND_LICENSING = "2019 (GNU GPL)"; 24 | 25 | /** 26 | * The name of this software's author. 27 | */ 28 | public static final String PRINCIPALAUTHOR_CREDIT = "Cory McKay"; 29 | 30 | /** 31 | * The credited institution. 32 | */ 33 | public static final String INSTITUTION_CREDIT = "CIRMMT / Marianopolis College / McGill University"; 34 | 35 | 36 | /* PUBLIC METHODS ***************************************************************************************/ 37 | 38 | 39 | /** 40 | * Runs the jSymbolic Feature Extractor. Operation will take place either in GUI or entirely via command 41 | * line processing, depending on the provided command line arguments. 42 | * 43 | * @param args Command line input parameter arguments. 44 | */ 45 | public static void main(String[] args) 46 | { 47 | try { CommandLineSwitchEnum.runCommandLine(args); } 48 | 49 | // Note that this should never need to be executed, since internal processing should catch all errors. 50 | catch (Exception e) 51 | { 52 | System.err.println(e.getMessage()); 53 | e.printStackTrace(System.err); 54 | // CommandLineUtils.printMessageAndTerminate(CommandLineUtils.getCommandLineCorrectUsage(), -1); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /src/jsymbolic2/configurationfile/ConfigFileOutputFilePaths.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.configurationfile; 2 | 3 | /** 4 | * An object of this class holds output file paths associated with a jSymbolic configuration file. 5 | * 6 | * @author Tristano Tenaglia and Cory McKay 7 | */ 8 | public class ConfigFileOutputFilePaths 9 | { 10 | /* FIELD ************************************************************************************************/ 11 | 12 | 13 | /** 14 | * The path to save feature values to in the form of an ACE XML feature values file. 15 | */ 16 | private final String feature_values_save_path; 17 | 18 | 19 | /* CONSTRUCTOR ******************************************************************************************/ 20 | 21 | 22 | /** 23 | * Instantiate an object holding the specified feature_values_save_path. 24 | * 25 | * @param feature_values_save_path The path to save feature values to in the form of an ACE XML feature 26 | * values file. 27 | */ 28 | public ConfigFileOutputFilePaths(String feature_values_save_path) 29 | { 30 | this.feature_values_save_path = feature_values_save_path; 31 | } 32 | 33 | 34 | /* METHODS **********************************************************************************************/ 35 | 36 | 37 | /** 38 | * Get the stored path to save feature values to in the form of an ACE XML feature values file. 39 | * 40 | * @return The stored path to save feature values to in the form of an ACE XML feature values file. 41 | */ 42 | public String getFeatureValuesSavePath() 43 | { 44 | return feature_values_save_path; 45 | } 46 | 47 | 48 | /** 49 | * Test if this object is equal to the specified object_to_test. 50 | * 51 | * @param object_to_test The object to compare this object to. 52 | * @return Whether or not this object equals object_to_test. 53 | */ 54 | @Override 55 | public boolean equals(Object object_to_test) 56 | { 57 | if (this == object_to_test) 58 | return true; 59 | if (object_to_test == null || getClass() != object_to_test.getClass()) 60 | return false; 61 | 62 | ConfigFileOutputFilePaths that = (ConfigFileOutputFilePaths) object_to_test; 63 | return feature_values_save_path != null ? feature_values_save_path.equals(that.feature_values_save_path) : that.feature_values_save_path == null; 64 | } 65 | 66 | 67 | /** 68 | * A hash code for this object. 69 | * 70 | * @return The hash code for this object. 71 | */ 72 | @Override 73 | public int hashCode() 74 | { 75 | int result = feature_values_save_path != null ? feature_values_save_path.hashCode() : 0; 76 | return 31 * result; 77 | } 78 | } -------------------------------------------------------------------------------- /src/jsymbolic2/configurationfile/EnumOutputFileTypes.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.configurationfile; 2 | 3 | /** 4 | * An enumeration of types of output file paths associated with a jSymbolic configuration file. 5 | * 6 | * @author Tristano Tenaglia and McKay 7 | */ 8 | public enum EnumOutputFileTypes {feature_values_save_path;} 9 | -------------------------------------------------------------------------------- /src/jsymbolic2/configurationfile/txtimplementation/ConfigFileFieldNameValuePair.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.configurationfile.txtimplementation; 2 | 3 | import jsymbolic2.configurationfile.EnumWindowingAndOutputFormatSettings; 4 | 5 | /** 6 | * An object of this class holds the name of a field and its corresponding value, as parsed from a jSymbolic 7 | * configurations file. 8 | * 9 | * @author Tristano Tenaglia and Cory McKay 10 | */ 11 | public class ConfigFileFieldNameValuePair 12 | { 13 | /* FIELDS *************0**********************************************************************************/ 14 | 15 | 16 | /** 17 | * The name of a field parsed from a jSymbolic configurations file. 18 | */ 19 | private final EnumWindowingAndOutputFormatSettings field_name; 20 | 21 | 22 | /** 23 | * The value corresponding to field_name, as parsed from a jSymbolic configurations file. 24 | */ 25 | private final String field_value; 26 | 27 | 28 | /* CONSTRUCTOR ******************************************************************************************/ 29 | 30 | 31 | /** 32 | * Instantiate an object of this class with the specified values. 33 | * 34 | * @param field_name The name of a field parsed from a jSymbolic configurations file. 35 | * @param field_value The value corresponding to field_name, as parsed from a jSymbolic configurations 36 | * file. 37 | */ 38 | public ConfigFileFieldNameValuePair(EnumWindowingAndOutputFormatSettings field_name, String field_value) 39 | { 40 | this.field_name = field_name; 41 | this.field_value = field_value; 42 | } 43 | 44 | 45 | /* METHODS **********************************************************************************************/ 46 | 47 | 48 | /** 49 | * @return The name of this field, as parsed from a jSymbolic configurations file. 50 | */ 51 | public EnumWindowingAndOutputFormatSettings getFieldName() 52 | { 53 | return field_name; 54 | } 55 | 56 | 57 | /** 58 | * @return The value of this field, as parsed from a jSymbolic configurations file. 59 | */ 60 | public String getFieldValue() 61 | { 62 | return field_value; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/jsymbolic2/configurationfile/txtimplementation/EnumFieldValueDelimiter.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.configurationfile.txtimplementation; 2 | 3 | /** 4 | * An enumerator specifying the string used to separate variable names from their values in the .txt 5 | * implementation of jSymbolic configuration files. Hardcoded to "=" in this case. 6 | * 7 | * @author Tristano Tenaglia and Cory McKay 8 | */ 9 | public enum EnumFieldValueDelimiter 10 | { 11 | /* CONSTANTS ********************************************************************************************/ 12 | 13 | 14 | /** 15 | * The delimiter separating variable names from variable values. 16 | */ 17 | EQUAL("="); 18 | 19 | 20 | /* FIELD ************************************************************************************************/ 21 | 22 | 23 | /** 24 | * The delimiter separating variable names from variable values. 25 | */ 26 | private final String delimiter; 27 | 28 | 29 | /* CONSTRUCTOR ******************************************************************************************/ 30 | 31 | 32 | /** 33 | * Set the delimiter value for the EQUAL element. 34 | * 35 | * @param delimiter The delimiter separating variable names from variable values. 36 | */ 37 | EnumFieldValueDelimiter(String delimiter) 38 | { 39 | this.delimiter = delimiter; 40 | } 41 | 42 | 43 | /* METHODS **********************************************************************************************/ 44 | 45 | 46 | /** 47 | * @return The delimiter separating variable names from variable values. 48 | */ 49 | @Override 50 | public String toString() 51 | { 52 | return delimiter; 53 | } 54 | } -------------------------------------------------------------------------------- /src/jsymbolic2/configurationfile/txtimplementation/EnumFileExtension.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.configurationfile.txtimplementation; 2 | 3 | /** 4 | * The file extension used for the .txt implementaiton of the jSymbolic configuration file. 5 | * 6 | * @author Tristano Tenaglia and Cory McKay 7 | */ 8 | public enum EnumFileExtension {txt} -------------------------------------------------------------------------------- /src/jsymbolic2/features/instrumentation/AcousticGuitarPrevalenceFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.instrumentation; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of all Note Ons played by acoustic guitar instruments (General 10 | * MIDI patches 25 and 26). 11 | * 12 | * @author Cory McKay 13 | */ 14 | public class AcousticGuitarPrevalenceFeature 15 | extends MIDIFeatureExtractor 16 | { 17 | /* CONSTRUCTOR ******************************************************************************************/ 18 | 19 | 20 | /** 21 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 22 | */ 23 | public AcousticGuitarPrevalenceFeature() 24 | { 25 | String name = "Acoustic Guitar Prevalence"; 26 | String code = "I-12"; 27 | String description = "Fraction of all Note Ons played by acoustic guitar instruments (General MIDI patches 25 and 26)."; 28 | boolean is_sequential = true; 29 | int dimensions = 1; 30 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 31 | dependencies = null; 32 | offsets = null; 33 | is_default = true; 34 | is_secure = false; 35 | } 36 | 37 | 38 | /* PUBLIC METHODS ***************************************************************************************/ 39 | 40 | 41 | /** 42 | * Extract this feature from the given sequence of MIDI data and its associated information. 43 | * 44 | * @param sequence The MIDI data to extract the feature from. 45 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 46 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 47 | * The order and offsets of these features must be the same as those returned 48 | * by this class' getDependencies and getDependencyOffsets methods, 49 | * respectively. The first indice indicates the feature/window, and the 50 | * second indicates the value. 51 | * @return The extracted feature value(s). 52 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 53 | */ 54 | @Override 55 | public double[] extractFeature( Sequence sequence, 56 | MIDIIntermediateRepresentations sequence_info, 57 | double[][] other_feature_values ) 58 | throws Exception 59 | { 60 | double value; 61 | if (sequence_info != null) 62 | { 63 | int[] instruments = { 24, 25 }; 64 | value = MIDIIntermediateRepresentations.calculateInstrumentGroupFrequency(instruments, sequence_info); 65 | } 66 | else value = -1.0; 67 | 68 | double[] result = new double[1]; 69 | result[0] = value; 70 | return result; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/jsymbolic2/features/instrumentation/ElectricGuitarPrevalenceFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.instrumentation; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of all Note Ons played by electric guitar instruments (General 10 | * MIDI patches 27 to 32). 11 | * 12 | * @author Cory McKay 13 | */ 14 | public class ElectricGuitarPrevalenceFeature 15 | extends MIDIFeatureExtractor 16 | { 17 | /* CONSTRUCTOR ******************************************************************************************/ 18 | 19 | 20 | /** 21 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 22 | */ 23 | public ElectricGuitarPrevalenceFeature() 24 | { 25 | String name = "Electric Guitar Prevalence"; 26 | String code = "I-13"; 27 | String description = "Fraction of all Note Ons played by electric guitar instruments (General MIDI patches 27 to 32)."; 28 | boolean is_sequential = true; 29 | int dimensions = 1; 30 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 31 | dependencies = null; 32 | offsets = null; 33 | is_default = true; 34 | is_secure = false; 35 | } 36 | 37 | 38 | /* PUBLIC METHODS ***************************************************************************************/ 39 | 40 | 41 | /** 42 | * Extract this feature from the given sequence of MIDI data and its associated information. 43 | * 44 | * @param sequence The MIDI data to extract the feature from. 45 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 46 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 47 | * The order and offsets of these features must be the same as those returned 48 | * by this class' getDependencies and getDependencyOffsets methods, 49 | * respectively. The first indice indicates the feature/window, and the 50 | * second indicates the value. 51 | * @return The extracted feature value(s). 52 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 53 | */ 54 | @Override 55 | public double[] extractFeature( Sequence sequence, 56 | MIDIIntermediateRepresentations sequence_info, 57 | double[][] other_feature_values ) 58 | throws Exception 59 | { 60 | double value; 61 | if (sequence_info != null) 62 | { 63 | int[] instruments = { 26, 27, 28, 29, 30, 31 }; 64 | value = MIDIIntermediateRepresentations.calculateInstrumentGroupFrequency(instruments, sequence_info); 65 | } 66 | else value = -1.0; 67 | 68 | double[] result = new double[1]; 69 | result[0] = value; 70 | return result; 71 | } 72 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/instrumentation/SaxophonePrevalenceFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.instrumentation; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of all Note Ons played by saxophone instruments (General MIDI 10 | * patches 65 to 68). 11 | * 12 | * @author Cory McKay 13 | */ 14 | public class SaxophonePrevalenceFeature 15 | extends MIDIFeatureExtractor 16 | { 17 | /* CONSTRUCTOR ******************************************************************************************/ 18 | 19 | 20 | /** 21 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 22 | */ 23 | public SaxophonePrevalenceFeature() 24 | { 25 | String name = "Saxophone Prevalence"; 26 | String code = "I-15"; 27 | String description = "Fraction of all Note Ons played by saxophone instruments (General MIDI patches 65 to 68)."; 28 | boolean is_sequential = true; 29 | int dimensions = 1; 30 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 31 | dependencies = null; 32 | offsets = null; 33 | is_default = true; 34 | is_secure = false; 35 | } 36 | 37 | 38 | /* PUBLIC METHODS ***************************************************************************************/ 39 | 40 | 41 | /** 42 | * Extract this feature from the given sequence of MIDI data and its associated information. 43 | * 44 | * @param sequence The MIDI data to extract the feature from. 45 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 46 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 47 | * The order and offsets of these features must be the same as those returned 48 | * by this class' getDependencies and getDependencyOffsets methods, 49 | * respectively. The first indice indicates the feature/window, and the 50 | * second indicates the value. 51 | * @return The extracted feature value(s). 52 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 53 | */ 54 | @Override 55 | public double[] extractFeature( Sequence sequence, 56 | MIDIIntermediateRepresentations sequence_info, 57 | double[][] other_feature_values ) 58 | throws Exception 59 | { 60 | double value; 61 | if (sequence_info != null) 62 | { 63 | int[] instruments = { 64, 65, 66, 67 }; 64 | value = MIDIIntermediateRepresentations.calculateInstrumentGroupFrequency(instruments, sequence_info); 65 | } 66 | else value = -1.0; 67 | 68 | double[] result = new double[1]; 69 | result[0] = value; 70 | return result; 71 | } 72 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/instrumentation/StringEnsemblePrevalenceFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.instrumentation; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of all Note Ons played by orchestral string ensemble 10 | * instruments (General MIDI patches 49 to 52). 11 | * 12 | * @author Cory McKay 13 | */ 14 | public class StringEnsemblePrevalenceFeature 15 | extends MIDIFeatureExtractor 16 | { 17 | /* CONSTRUCTOR ******************************************************************************************/ 18 | 19 | 20 | /** 21 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 22 | */ 23 | public StringEnsemblePrevalenceFeature() 24 | { 25 | String name = "String Ensemble Prevalence"; 26 | String code = "I-19"; 27 | String description = "Fraction of all Note Ons played by orchestral string ensemble instruments (General MIDI patches 49 to 52)."; 28 | boolean is_sequential = true; 29 | int dimensions = 1; 30 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 31 | dependencies = null; 32 | offsets = null; 33 | is_default = true; 34 | is_secure = false; 35 | } 36 | 37 | 38 | /* PUBLIC METHODS ***************************************************************************************/ 39 | 40 | 41 | /** 42 | * Extract this feature from the given sequence of MIDI data and its associated information. 43 | * 44 | * @param sequence The MIDI data to extract the feature from. 45 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 46 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 47 | * The order and offsets of these features must be the same as those returned 48 | * by this class' getDependencies and getDependencyOffsets methods, 49 | * respectively. The first indice indicates the feature/window, and the 50 | * second indicates the value. 51 | * @return The extracted feature value(s). 52 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 53 | */ 54 | @Override 55 | public double[] extractFeature( Sequence sequence, 56 | MIDIIntermediateRepresentations sequence_info, 57 | double[][] other_feature_values ) 58 | throws Exception 59 | { 60 | double value; 61 | if (sequence_info != null) 62 | { 63 | int[] instruments = { 48, 49, 50, 51 }; 64 | value = MIDIIntermediateRepresentations.calculateInstrumentGroupFrequency(instruments, sequence_info); 65 | } 66 | else value = -1.0; 67 | 68 | double[] result = new double[1]; 69 | result[0] = value; 70 | return result; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/jsymbolic2/features/instrumentation/StringKeyboardPrevalenceFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.instrumentation; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of all Note Ons played by string keyboard instruments (General 10 | * MIDI patches 1 to 8). 11 | * 12 | * @author Cory McKay 13 | */ 14 | public class StringKeyboardPrevalenceFeature 15 | extends MIDIFeatureExtractor 16 | { 17 | /* CONSTRUCTOR ******************************************************************************************/ 18 | 19 | 20 | /** 21 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 22 | */ 23 | public StringKeyboardPrevalenceFeature() 24 | { 25 | String name = "String Keyboard Prevalence"; 26 | String code = "I-11"; 27 | String description = "Fraction of all Note Ons played by string keyboard instruments (General MIDI patches 1 to 8)."; 28 | boolean is_sequential = true; 29 | int dimensions = 1; 30 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 31 | dependencies = null; 32 | offsets = null; 33 | is_default = true; 34 | is_secure = false; 35 | } 36 | 37 | 38 | /* PUBLIC METHODS ***************************************************************************************/ 39 | 40 | 41 | /** 42 | * Extract this feature from the given sequence of MIDI data and its associated information. 43 | * 44 | * @param sequence The MIDI data to extract the feature from. 45 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 46 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 47 | * The order and offsets of these features must be the same as those returned 48 | * by this class' getDependencies and getDependencyOffsets methods, 49 | * respectively. The first indice indicates the feature/window, and the 50 | * second indicates the value. 51 | * @return The extracted feature value(s). 52 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 53 | */ 54 | @Override 55 | public double[] extractFeature( Sequence sequence, 56 | MIDIIntermediateRepresentations sequence_info, 57 | double[][] other_feature_values ) 58 | throws Exception 59 | { 60 | double value; 61 | if (sequence_info != null) 62 | { 63 | int[] instruments = { 0, 1, 2, 3, 4, 5, 6, 7 }; 64 | value = MIDIIntermediateRepresentations.calculateInstrumentGroupFrequency(instruments, sequence_info); 65 | } 66 | else value = -1.0; 67 | 68 | double[] result = new double[1]; 69 | result[0] = value; 70 | return result; 71 | } 72 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/instrumentation/ViolinPrevalenceFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.instrumentation; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of all Note Ons played by violin instruments (General MIDI 10 | * patches 41 or 111). 11 | * 12 | * @author Cory McKay 13 | */ 14 | public class ViolinPrevalenceFeature 15 | extends MIDIFeatureExtractor 16 | { 17 | /* CONSTRUCTOR ******************************************************************************************/ 18 | 19 | 20 | /** 21 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 22 | */ 23 | public ViolinPrevalenceFeature() 24 | { 25 | String name = "Violin Prevalence"; 26 | String code = "I-14"; 27 | String description = "Fraction of all Note Ons played by violin instruments (General MIDI patches 41 or 111)."; 28 | boolean is_sequential = true; 29 | int dimensions = 1; 30 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 31 | dependencies = null; 32 | offsets = null; 33 | is_default = true; 34 | is_secure = false; 35 | } 36 | 37 | 38 | /* PUBLIC METHODS ***************************************************************************************/ 39 | 40 | 41 | /** 42 | * Extract this feature from the given sequence of MIDI data and its associated information. 43 | * 44 | * @param sequence The MIDI data to extract the feature from. 45 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 46 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 47 | * The order and offsets of these features must be the same as those returned 48 | * by this class' getDependencies and getDependencyOffsets methods, 49 | * respectively. The first indice indicates the feature/window, and the 50 | * second indicates the value. 51 | * @return The extracted feature value(s). 52 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 53 | */ 54 | @Override 55 | public double[] extractFeature( Sequence sequence, 56 | MIDIIntermediateRepresentations sequence_info, 57 | double[][] other_feature_values ) 58 | throws Exception 59 | { 60 | double value; 61 | if (sequence_info != null) 62 | { 63 | int[] instruments = { 40, 110 }; 64 | value = MIDIIntermediateRepresentations.calculateInstrumentGroupFrequency(instruments, sequence_info); 65 | } 66 | else value = -1.0; 67 | 68 | double[] result = new double[1]; 69 | result[0] = value; 70 | return result; 71 | } 72 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/instrumentation/WoodwindsPrevalenceFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.instrumentation; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of all Note Ons played by woodwind instruments (General MIDI 10 | * patches 69 to 76). 11 | * 12 | * @author Cory McKay 13 | */ 14 | public class WoodwindsPrevalenceFeature 15 | extends MIDIFeatureExtractor 16 | { 17 | /* CONSTRUCTOR ******************************************************************************************/ 18 | 19 | 20 | /** 21 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 22 | */ 23 | public WoodwindsPrevalenceFeature() 24 | { 25 | String name = "Woodwinds Prevalence"; 26 | String code = "I-17"; 27 | String description = "Fraction of all Note Ons played by woodwind instruments (General MIDI patches 69 to 76)."; 28 | boolean is_sequential = true; 29 | int dimensions = 1; 30 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 31 | dependencies = null; 32 | offsets = null; 33 | is_default = true; 34 | is_secure = false; 35 | } 36 | 37 | 38 | /* PUBLIC METHODS ***************************************************************************************/ 39 | 40 | 41 | /** 42 | * Extract this feature from the given sequence of MIDI data and its associated information. 43 | * 44 | * @param sequence The MIDI data to extract the feature from. 45 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 46 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 47 | * The order and offsets of these features must be the same as those returned 48 | * by this class' getDependencies and getDependencyOffsets methods, 49 | * respectively. The first indice indicates the feature/window, and the 50 | * second indicates the value. 51 | * @return The extracted feature value(s). 52 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 53 | */ 54 | @Override 55 | public double[] extractFeature( Sequence sequence, 56 | MIDIIntermediateRepresentations sequence_info, 57 | double[][] other_feature_values ) 58 | throws Exception 59 | { 60 | double value; 61 | if (sequence_info != null) 62 | { 63 | int[] instruments = { 68, 69, 70, 71, 72, 73, 74, 75 }; 64 | value = MIDIIntermediateRepresentations.calculateInstrumentGroupFrequency(instruments, sequence_info); 65 | } 66 | else value = -1.0; 67 | 68 | double[] result = new double[1]; 69 | result[0] = value; 70 | return result; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/ChromaticMotionFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of melodic intervals that correspond to a semitone. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class ChromaticMotionFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public ChromaticMotionFeature() 23 | { 24 | String name = "Chromatic Motion"; 25 | String code = "M-10"; 26 | String description = "Fraction of melodic intervals that correspond to a semitone."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value; 60 | if (sequence_info != null) 61 | value = sequence_info.melodic_interval_histogram[1]; 62 | else value = -1.0; 63 | 64 | double[] result = new double[1]; 65 | result[0] = value; 66 | return result; 67 | } 68 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/MeanMelodicIntervalFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the mean average (in semitones) of the intervals involved in each of the 10 | * melodic intervals in the piece. 11 | * 12 | * @author Cory McKay 13 | */ 14 | public class MeanMelodicIntervalFeature 15 | extends MIDIFeatureExtractor 16 | { 17 | /* CONSTRUCTOR ******************************************************************************************/ 18 | 19 | 20 | /** 21 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 22 | */ 23 | public MeanMelodicIntervalFeature() 24 | { 25 | String name = "Mean Melodic Interval"; 26 | String code = "M-3"; 27 | String description = "Mean average (in semitones) of the intervals involved in each of the melodic intervals in the piece."; 28 | boolean is_sequential = true; 29 | int dimensions = 1; 30 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 31 | dependencies = null; 32 | offsets = null; 33 | is_default = true; 34 | is_secure = true; 35 | } 36 | 37 | 38 | /* PUBLIC METHODS ***************************************************************************************/ 39 | 40 | 41 | /** 42 | * Extract this feature from the given sequence of MIDI data and its associated information. 43 | * 44 | * @param sequence The MIDI data to extract the feature from. 45 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 46 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 47 | * The order and offsets of these features must be the same as those returned 48 | * by this class' getDependencies and getDependencyOffsets methods, 49 | * respectively. The first indice indicates the feature/window, and the 50 | * second indicates the value. 51 | * @return The extracted feature value(s). 52 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 53 | */ 54 | @Override 55 | public double[] extractFeature( Sequence sequence, 56 | MIDIIntermediateRepresentations sequence_info, 57 | double[][] other_feature_values ) 58 | throws Exception 59 | { 60 | double value; 61 | if (sequence_info != null) 62 | { 63 | value = 0.0; 64 | for (int i = 0; i < sequence_info.melodic_interval_histogram.length; i++) 65 | value += (double) i * sequence_info.melodic_interval_histogram[i]; 66 | } 67 | else value = -1.0; 68 | 69 | double[] result = new double[1]; 70 | result[0] = value; 71 | return result; 72 | } 73 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/MelodicLargeIntervalsFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of melodic intervals greater than one octave.. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class MelodicLargeIntervalsFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public MelodicLargeIntervalsFeature() 23 | { 24 | String name = "Melodic Large Intervals"; 25 | String code = "M-19"; 26 | String description = "Fraction of melodic intervals greater than one octave."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value = 0.0; 60 | if (sequence_info != null) 61 | for (int i = 13; i < sequence_info.melodic_interval_histogram.length; i++) 62 | value += sequence_info.melodic_interval_histogram[i]; 63 | else value = -1.0; 64 | 65 | double[] result = new double[1]; 66 | result[0] = value; 67 | return result; 68 | } 69 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/MelodicOctavesFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of melodic intervals that are octaves. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class MelodicOctavesFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public MelodicOctavesFeature() 23 | { 24 | String name = "Melodic Octaves"; 25 | String code = "M-18"; 26 | String description = "Fraction of melodic intervals that are octaves."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value; 60 | if (sequence_info != null) 61 | value = sequence_info.melodic_interval_histogram[12]; 62 | else value = -1.0; 63 | 64 | double[] result = new double[1]; 65 | result[0] = value; 66 | return result; 67 | } 68 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/MelodicPerfectFifthsFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of melodic intervals that are perfect fifths. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class MelodicPerfectFifthsFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public MelodicPerfectFifthsFeature() 23 | { 24 | String name = "Melodic Perfect Fifths"; 25 | String code = "M-15"; 26 | String description = "Fraction of melodic intervals that are perfect fifths."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value; 60 | if (sequence_info != null) 61 | value = sequence_info.melodic_interval_histogram[7]; 62 | else value = -1.0; 63 | 64 | double[] result = new double[1]; 65 | result[0] = value; 66 | return result; 67 | } 68 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/MelodicPerfectFourthsFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of melodic intervals that are perfect fourths. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class MelodicPerfectFourthsFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public MelodicPerfectFourthsFeature() 23 | { 24 | String name = "Melodic Perfect Fourths"; 25 | String code = "M-13"; 26 | String description = "Fraction of melodic intervals that are perfect fourths."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value; 60 | if (sequence_info != null) 61 | value = sequence_info.melodic_interval_histogram[5]; 62 | else value = -1.0; 63 | 64 | double[] result = new double[1]; 65 | result[0] = value; 66 | return result; 67 | } 68 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/MelodicSeventhsFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of melodic intervals that are major or minor thirds. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class MelodicSeventhsFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public MelodicSeventhsFeature() 23 | { 24 | String name = "Melodic Sevenths"; 25 | String code = "M-17"; 26 | String description = "Fraction of melodic intervals that are major or minor sevenths."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value; 60 | if (sequence_info != null) 61 | value = sequence_info.melodic_interval_histogram[10] + sequence_info.melodic_interval_histogram[11]; 62 | else value = -1.0; 63 | 64 | double[] result = new double[1]; 65 | result[0] = value; 66 | return result; 67 | } 68 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/MelodicSixthsFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of melodic intervals that are major or minor sixths. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class MelodicSixthsFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public MelodicSixthsFeature() 23 | { 24 | String name = "Melodic Sixths"; 25 | String code = "M-16"; 26 | String description = "Fraction of melodic intervals that are major or minor sixths."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value; 60 | if (sequence_info != null) 61 | value = sequence_info.melodic_interval_histogram[8] + sequence_info.melodic_interval_histogram[9]; 62 | else value = -1.0; 63 | 64 | double[] result = new double[1]; 65 | result[0] = value; 66 | return result; 67 | } 68 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/MelodicThirdsFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of melodic intervals that are major or minor thirds. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class MelodicThirdsFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public MelodicThirdsFeature() 23 | { 24 | String name = "Melodic Thirds"; 25 | String code = "M-12"; 26 | String description = "Fraction of melodic intervals that are major or minor thirds."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value; 60 | if (sequence_info != null) 61 | value = sequence_info.melodic_interval_histogram[3] + sequence_info.melodic_interval_histogram[4]; 62 | else value = -1.0; 63 | 64 | double[] result = new double[1]; 65 | result[0] = value; 66 | return result; 67 | } 68 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/MelodicTritonesFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of melodic intervals that are tritones. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class MelodicTritonesFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public MelodicTritonesFeature() 23 | { 24 | String name = "Melodic Tritones"; 25 | String code = "M-14"; 26 | String description = "Fraction of melodic intervals that are tritones."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value; 60 | if (sequence_info != null) 61 | value = sequence_info.melodic_interval_histogram[6]; 62 | else value = -1.0; 63 | 64 | double[] result = new double[1]; 65 | result[0] = value; 66 | return result; 67 | } 68 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/MostCommonMelodicIntervalFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the number of semitones corresponding to the most frequently occurring 10 | * melodic interval. 11 | * 12 | * @author Cory McKay 13 | */ 14 | public class MostCommonMelodicIntervalFeature 15 | extends MIDIFeatureExtractor 16 | { 17 | 18 | /* CONSTRUCTOR ******************************************************************************************/ 19 | 20 | /** 21 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 22 | */ 23 | public MostCommonMelodicIntervalFeature() 24 | { 25 | String name = "Most Common Melodic Interval"; 26 | String code = "M-2"; 27 | String description = "Number of semitones corresponding to the most frequently occurring melodic interval."; 28 | boolean is_sequential = true; 29 | int dimensions = 1; 30 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 31 | dependencies = null; 32 | offsets = null; 33 | is_default = true; 34 | is_secure = true; 35 | } 36 | 37 | 38 | /* PUBLIC METHODS ***************************************************************************************/ 39 | 40 | 41 | /** 42 | * Extract this feature from the given sequence of MIDI data and its associated information. 43 | * 44 | * @param sequence The MIDI data to extract the feature from. 45 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 46 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 47 | * The order and offsets of these features must be the same as those returned 48 | * by this class' getDependencies and getDependencyOffsets methods, 49 | * respectively. The first indice indicates the feature/window, and the 50 | * second indicates the value. 51 | * @return The extracted feature value(s). 52 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 53 | */ 54 | @Override 55 | public double[] extractFeature( Sequence sequence, 56 | MIDIIntermediateRepresentations sequence_info, 57 | double[][] other_feature_values ) 58 | throws Exception 59 | { 60 | double value; 61 | if (sequence_info != null) 62 | { 63 | int max_index = mckay.utilities.staticlibraries.MathAndStatsMethods.getIndexOfLargest(sequence_info.melodic_interval_histogram); 64 | value = (double) max_index; 65 | } 66 | else value = -1.0; 67 | 68 | double[] result = new double[1]; 69 | result[0] = value; 70 | return result; 71 | } 72 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/RepeatedNotesFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of melodic intervals that correspond to repeated notes. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class RepeatedNotesFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public RepeatedNotesFeature() 23 | { 24 | String name = "Repeated Notes"; 25 | String code = "M-9"; 26 | String description = "Fraction of melodic intervals that correspond to repeated notes."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value; 60 | if (sequence_info != null) 61 | value = sequence_info.melodic_interval_histogram[0]; 62 | else value = -1.0; 63 | 64 | double[] result = new double[1]; 65 | result[0] = value; 66 | return result; 67 | } 68 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/melodicintervals/StepwiseMotionFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.melodicintervals; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of melodic intervals that correspond to a minor or major 10 | * second. 11 | * 12 | * @author Cory McKay 13 | */ 14 | public class StepwiseMotionFeature 15 | extends MIDIFeatureExtractor 16 | { 17 | /* CONSTRUCTOR ******************************************************************************************/ 18 | 19 | 20 | /** 21 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 22 | */ 23 | public StepwiseMotionFeature() 24 | { 25 | String name = "Stepwise Motion"; 26 | String code = "M-11"; 27 | String description = "Fraction of melodic intervals that correspond to a minor or major second."; 28 | boolean is_sequential = true; 29 | int dimensions = 1; 30 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 31 | dependencies = null; 32 | offsets = null; 33 | is_default = true; 34 | is_secure = true; 35 | } 36 | 37 | 38 | /* PUBLIC METHODS ***************************************************************************************/ 39 | 40 | 41 | /** 42 | * Extract this feature from the given sequence of MIDI data and its associated information. 43 | * 44 | * @param sequence The MIDI data to extract the feature from. 45 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 46 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 47 | * The order and offsets of these features must be the same as those returned 48 | * by this class' getDependencies and getDependencyOffsets methods, 49 | * respectively. The first indice indicates the feature/window, and the 50 | * second indicates the value. 51 | * @return The extracted feature value(s). 52 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 53 | */ 54 | @Override 55 | public double[] extractFeature( Sequence sequence, 56 | MIDIIntermediateRepresentations sequence_info, 57 | double[][] other_feature_values ) 58 | throws Exception 59 | { 60 | double value; 61 | if (sequence_info != null) 62 | value = sequence_info.melodic_interval_histogram[1] + sequence_info.melodic_interval_histogram[2]; 63 | else value = -1.0; 64 | 65 | double[] result = new double[1]; 66 | result[0] = value; 67 | return result; 68 | } 69 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/pitchstatistics/ImportanceOfBassRegisterFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.pitchstatistics; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of notes between MIDI pitches 0 and 54. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class ImportanceOfBassRegisterFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public ImportanceOfBassRegisterFeature() 23 | { 24 | String name = "Importance of Bass Register"; 25 | String code = "P-9"; 26 | String description = "Fraction of notes between MIDI pitches 0 and 54."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value; 60 | if (sequence_info != null) 61 | { 62 | value = 0.0; 63 | for (int bin = 0; bin <= 54; bin++) 64 | value += sequence_info.basic_pitch_histogram[bin]; 65 | } 66 | else value = -1.0; 67 | 68 | double[] result = new double[1]; 69 | result[0] = value; 70 | return result; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/jsymbolic2/features/pitchstatistics/ImportanceOfHighRegisterFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.pitchstatistics; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of notes between MIDI pitches 73 and 127. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class ImportanceOfHighRegisterFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public ImportanceOfHighRegisterFeature() 23 | { 24 | String name = "Importance of High Register"; 25 | String code = "P-11"; 26 | String description = "Fraction of notes between MIDI pitches 73 and 127."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value; 60 | if (sequence_info != null) 61 | { 62 | value = 0.0; 63 | for (int bin = 73; bin < sequence_info.basic_pitch_histogram.length; bin++) 64 | value += sequence_info.basic_pitch_histogram[bin]; 65 | } 66 | else value = -1.0; 67 | 68 | double[] result = new double[1]; 69 | result[0] = value; 70 | return result; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/jsymbolic2/features/pitchstatistics/ImportanceOfMiddleRegisterFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.pitchstatistics; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the fraction of notes between MIDI pitches 55 and 72. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class ImportanceOfMiddleRegisterFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public ImportanceOfMiddleRegisterFeature() 23 | { 24 | String name = "Importance of Middle Register"; 25 | String code = "P-10"; 26 | String description = "Fraction of notes between MIDI pitches 55 and 72."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double value; 60 | if (sequence_info != null) 61 | { 62 | value = 0.0; 63 | for (int bin = 55; bin <= 72; bin++) 64 | value += sequence_info.basic_pitch_histogram[bin]; 65 | } 66 | else value = -1.0; 67 | 68 | double[] result = new double[1]; 69 | result[0] = value; 70 | return result; 71 | } 72 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/rhythm/DurationInSecondsFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.rhythm; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the total duration (in seconds) of the piece. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class DurationInSecondsFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public DurationInSecondsFeature() 23 | { 24 | String name = "Duration in Seconds"; 25 | String code = "RT-4"; 26 | String description = "Total duration (in seconds) of the piece."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = false; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double[] result = new double[1]; 60 | result[0] = (double) (sequence.getMicrosecondLength() / 1000000.0); 61 | return result; 62 | } 63 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/rhythm/InitialTempoFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.rhythm; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the tempo in beats per minute at the start of the piece. Set to the default 10 | * MIDI value (120 BPM) if no tempo is specified explicitly. 11 | * 12 | * @author Cory McKay 13 | */ 14 | public class InitialTempoFeature 15 | extends MIDIFeatureExtractor 16 | { 17 | /* CONSTRUCTOR ******************************************************************************************/ 18 | 19 | 20 | /** 21 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 22 | */ 23 | public InitialTempoFeature() 24 | { 25 | String name = "Initial Tempo"; 26 | String code = "RT-1"; 27 | String description = "Tempo in beats per minute at the start of the piece. Set to the default MIDI value (120 BPM) if no tempo is specified explicitly."; 28 | boolean is_sequential = true; 29 | int dimensions = 1; 30 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 31 | dependencies = null; 32 | offsets = null; 33 | is_default = true; 34 | is_secure = false; 35 | } 36 | 37 | 38 | /* PUBLIC METHODS ***************************************************************************************/ 39 | 40 | 41 | /** 42 | * Extract this feature from the given sequence of MIDI data and its associated information. 43 | * 44 | * @param sequence The MIDI data to extract the feature from. 45 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 46 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 47 | * The order and offsets of these features must be the same as those returned 48 | * by this class' getDependencies and getDependencyOffsets methods, 49 | * respectively. The first indice indicates the feature/window, and the 50 | * second indicates the value. 51 | * @return The extracted feature value(s). 52 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 53 | */ 54 | @Override 55 | public double[] extractFeature( Sequence sequence, 56 | MIDIIntermediateRepresentations sequence_info, 57 | double[][] other_feature_values ) 58 | throws Exception 59 | { 60 | double value; 61 | 62 | if (sequence_info != null) 63 | value = ((Integer) sequence_info.overall_metadata[3]).doubleValue(); 64 | else value = -1.0; 65 | 66 | double[] result = new double[1]; 67 | result[0] = value; 68 | return result; 69 | } 70 | } -------------------------------------------------------------------------------- /src/jsymbolic2/features/rhythm/TotalNumberOfNotesFeature.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features.rhythm; 2 | 3 | import javax.sound.midi.*; 4 | import ace.datatypes.FeatureDefinition; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | 8 | /** 9 | * A feature calculator that finds the total number of notes, including both pitched and unpitched notes. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class TotalNumberOfNotesFeature 14 | extends MIDIFeatureExtractor 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Basic constructor that sets the values of the fields inherited from this class' superclass. 21 | */ 22 | public TotalNumberOfNotesFeature() 23 | { 24 | String name = "Total Number of Notes"; 25 | String code = "R-9"; 26 | String description = "Total number of notes, including both pitched and unpitched notes."; 27 | boolean is_sequential = true; 28 | int dimensions = 1; 29 | definition = new FeatureDefinition(name, code, description, is_sequential, dimensions, jsymbolic2.Main.SOFTWARE_NAME_AND_VERSION); 30 | dependencies = null; 31 | offsets = null; 32 | is_default = true; 33 | is_secure = true; 34 | } 35 | 36 | 37 | /* PUBLIC METHODS ***************************************************************************************/ 38 | 39 | 40 | /** 41 | * Extract this feature from the given sequence of MIDI data and its associated information. 42 | * 43 | * @param sequence The MIDI data to extract the feature from. 44 | * @param sequence_info Additional data already extracted from the the MIDI sequence. 45 | * @param other_feature_values The values of other features that may be needed to calculate this feature. 46 | * The order and offsets of these features must be the same as those returned 47 | * by this class' getDependencies and getDependencyOffsets methods, 48 | * respectively. The first indice indicates the feature/window, and the 49 | * second indicates the value. 50 | * @return The extracted feature value(s). 51 | * @throws Exception Throws an informative exception if the feature cannot be calculated. 52 | */ 53 | @Override 54 | public double[] extractFeature( Sequence sequence, 55 | MIDIIntermediateRepresentations sequence_info, 56 | double[][] other_feature_values ) 57 | throws Exception 58 | { 59 | double[] result = new double[1]; 60 | result[0] = (double) sequence_info.total_number_note_ons; 61 | return result; 62 | } 63 | } -------------------------------------------------------------------------------- /src/jsymbolic2/gui/SymbolicMusicFile.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.gui; 2 | 3 | import java.io.File; 4 | import javax.sound.midi.Sequence; 5 | 6 | /** 7 | * A class for holding a reference to a symbolic music file and MIDI data associated with (or generated from) 8 | * it. This is typically a MIDI file or an MEI file. 9 | * 10 | * @author Cory McKay 11 | */ 12 | public class SymbolicMusicFile 13 | { 14 | /* FIELDS ***********************************************************************************************/ 15 | 16 | 17 | /** 18 | * The path of the symbolic music file. Should be unique. 19 | */ 20 | public final String file_path; 21 | 22 | /** 23 | * The name of this symbolic music file (not including the complete path). 24 | */ 25 | public final String file_name; 26 | 27 | /** 28 | * A MIDI sequence parsed (or generated) from this symbolic music file. May sometimes be set to null in 29 | * order to save space, but in such a case it can still be parsed from the symbolic music file. 30 | */ 31 | public Sequence midi_sequence; 32 | 33 | 34 | /* CONSTRUCTOR ******************************************************************************************/ 35 | 36 | 37 | /** 38 | * Instantiate a SymbolicMusicFile and store its associated sequence, if provided. 39 | * 40 | * @param symbolic_music_file The symbolic music file to store a reference to. Typically a MIDI or MEI 41 | * file. 42 | * @param midi_sequence A MIDI sequence associated with the symbolic_music_file. Typically parsed 43 | * from it (in the case of MIDI files) or generated from it (other symbolic 44 | * music file types). May be null if this information is not available or is 45 | * not to be stored. 46 | */ 47 | public SymbolicMusicFile(File symbolic_music_file, Sequence midi_sequence) 48 | { 49 | file_name = symbolic_music_file.getName(); 50 | file_path = symbolic_music_file.getPath(); 51 | this.midi_sequence = midi_sequence; 52 | } 53 | } -------------------------------------------------------------------------------- /src/jsymbolic2/gui/SymbolicMusicFilesTableModel.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.gui; 2 | 3 | import javax.swing.table.DefaultTableModel; 4 | 5 | /** 6 | * The table model used by the symbolic_music_files_table JTable in MusicFileSelectorPanel to list all 7 | * symbolic music files from which features are to be extracted. The file path for each such file is listed in 8 | * its own row, with one column for the file name and one for the file path. Provides methods to fill the 9 | * table row by row and to delete everything in it. Makes all cells non-editable. 10 | * 11 | * @author Cory McKay 12 | */ 13 | public class SymbolicMusicFilesTableModel 14 | extends DefaultTableModel 15 | { 16 | /* CONSTRUCTOR ******************************************************************************************/ 17 | 18 | 19 | /** 20 | * Simply calls the DefaultTableModel constructor. 21 | */ 22 | SymbolicMusicFilesTableModel(Object[] column_names, int rows) 23 | { 24 | super(column_names, rows); 25 | } 26 | 27 | 28 | /* PUBLIC METHODS ***************************************************************************************/ 29 | 30 | 31 | /** 32 | * Deletes everything in the table and then fills it up one row at a time based on the given 33 | * symbolic_music_files. 34 | * 35 | * @param symbolic_music_files Files to include on the table, in the order that they are to be added 36 | * to it. If this is null, then the table is simply cleared of any 37 | * existing rows. 38 | */ 39 | public void resetAndFillTable(SymbolicMusicFile[] symbolic_music_files) 40 | { 41 | // Clear the contents of the table 42 | clearTable(); 43 | 44 | // Populate each row one by one 45 | if (symbolic_music_files != null) 46 | { 47 | for (SymbolicMusicFile this_music_file : symbolic_music_files) 48 | { 49 | Object[] row_contents = { this_music_file.file_name, this_music_file.file_path }; 50 | addRow(row_contents); 51 | } 52 | } 53 | } 54 | 55 | 56 | /** 57 | * Removes all rows in the table. 58 | */ 59 | public void clearTable() 60 | { 61 | while (getRowCount() != 0) 62 | removeRow(0); 63 | } 64 | 65 | 66 | /** 67 | * Returns false for all cells on the table, with the effect that no cells are editable. 68 | * 69 | * @param row The table row to check. 70 | * @param column The table column to check. 71 | * @return Whether or not the cell at the specified row and column is editable. 72 | */ 73 | @Override 74 | public boolean isCellEditable(int row, int column) 75 | { 76 | return false; 77 | } 78 | } -------------------------------------------------------------------------------- /src/jsymbolic2/processing/MusicFilter.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.processing; 2 | 3 | import java.io.File; 4 | import java.io.FileFilter; 5 | 6 | /** 7 | * A FileFilter that only accepts files with MIDI or MEI extensions (.mei, .midi or .mid). Case is ignored. 8 | * 9 | * @author Tristano Tenaglia and Cory McKay 10 | */ 11 | public class MusicFilter implements FileFilter 12 | { 13 | /* PRIVATE STATIC FIELDSS *******************************************************************************/ 14 | 15 | 16 | /** 17 | * File extensions that are accepted by this FileFilter. 18 | */ 19 | private static final String[] accepted_file_extensions = new String[] { ".mei", ".midi", ".mid" }; 20 | 21 | 22 | /* PUBLIC METHODS ***************************************************************************************/ 23 | 24 | 25 | /** 26 | * Check to see if the specified file path ends with an accepted extension. These are .mei, .midi or .mid, 27 | * in any case. 28 | * 29 | * @param file The file to check. 30 | * @return Whether or not the file path ends with an accepted extension. 31 | */ 32 | @Override 33 | public boolean accept(File file) 34 | { 35 | for (String extension : accepted_file_extensions) 36 | if (file.getName().toLowerCase().endsWith(extension)) 37 | return true; 38 | return false; 39 | } 40 | 41 | 42 | /* PUBLIC STATIC METHODS **************(*****************************************************************/ 43 | 44 | 45 | /** 46 | * Check to see if the specified file path ends with an accepted extension. These are .mei, .midi or .mid, 47 | * in any case. 48 | * 49 | * @param file The file to check. 50 | * @return Whether or not the file path ends with an accepted extension. 51 | */ 52 | public static boolean passesFilter(File file) 53 | { 54 | for (String extension : accepted_file_extensions) 55 | if (file.getName().toLowerCase().endsWith(extension)) 56 | return true; 57 | return false; 58 | } 59 | } -------------------------------------------------------------------------------- /test/jsymbolic2/api/resources/Chopin_Mazurka.midi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/test/jsymbolic2/api/resources/Chopin_Mazurka.midi -------------------------------------------------------------------------------- /test/jsymbolic2/api/resources/sampleConfigConvert.txt: -------------------------------------------------------------------------------- 1 | 2 | Acoustic Guitar Prevalence 3 | Duration 4 | Beat Histogram 5 | 6 | window_size=1.5 7 | window_overlap=0.1 8 | save_features_for_each_window=false 9 | save_overall_recording_features=true 10 | convert_to_arff=true 11 | convert_to_csv=true 12 | 13 | feature_values_save_path=./test/jsymbolic2/api/resources/feature_values.xml 14 | feature_definitions_save_path=./test/jsymbolic2/api/resources/feature_definitions.xml 15 | 16 | ./test/jsymbolic2/api/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei 17 | ./test/jsymbolic2/api/resources/Chopin_Mazurka.midi 18 | -------------------------------------------------------------------------------- /test/jsymbolic2/api/resources/sampleConfiguration.txt: -------------------------------------------------------------------------------- 1 | 2 | Acoustic Guitar Prevalence 3 | Duration 4 | Beat Histogram 5 | 6 | window_size=1.5 7 | window_overlap=0.1 8 | save_features_for_each_window=true 9 | save_overall_recording_features=false 10 | convert_to_arff=false 11 | convert_to_csv=false 12 | 13 | feature_values_save_path=test_value.xml 14 | feature_definitions_save_path=test_definition.xml 15 | 16 | ./test/jsymbolic2/api/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei 17 | ./test/jsymbolic2/api/resources/Chopin_Mazurka.midi 18 | -------------------------------------------------------------------------------- /test/jsymbolic2/configuration/ConfigurationFileDataTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.configuration; 2 | 3 | import jsymbolic2.configurationfile.ConfigFileOutputFilePaths; 4 | import jsymbolic2.configurationfile.ConfigFileCompleteData; 5 | import jsymbolic2.configurationfile.ConfigFileInputFilePaths; 6 | import jsymbolic2.configurationfile.ConfigFileWindowingAndOutputFormatSettings; 7 | import jsymbolic2.featureutils.FeatureExtractorAccess; 8 | import org.junit.Test; 9 | 10 | import java.io.File; 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * Created by dinamix on 5/24/16. 18 | */ 19 | public class ConfigurationFileDataTest { 20 | @Test 21 | public void getFeaturesToSaveBoolean() throws Exception { 22 | List inputFeatures = Arrays.asList("Brass Prevalence","Duration"); 23 | ConfigFileWindowingAndOutputFormatSettings optionState = new ConfigFileWindowingAndOutputFormatSettings(10,0.1,true,false,false,false); 24 | ConfigFileOutputFilePaths outputFiles = new ConfigFileOutputFilePaths("valuetest.xml"); 25 | ConfigFileInputFilePaths inputFiles = new ConfigFileInputFilePaths(); 26 | inputFiles.addValidFile(new File("./test/jsymbolic/features/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei")); 27 | String configFilePath = "/workspace/ddmal/jSymbolic/test/jsymbolic/configuration/resources/sampleConfiguration.txt"; 28 | ConfigFileCompleteData data = new ConfigFileCompleteData(inputFeatures,optionState,outputFiles,configFilePath,inputFiles); 29 | 30 | boolean[] expectedSave = new boolean[FeatureExtractorAccess.getNamesOfAllImplementedFeatures().size()]; 31 | expectedSave = initializeArrayFalse(expectedSave); 32 | expectedSave[121] = true; //Duration feature 33 | expectedSave[137] = true; //Brass Fraction feature 34 | assertArrayEquals(expectedSave,data.getFeaturesToSaveBoolean()); 35 | } 36 | 37 | private boolean[] initializeArrayFalse(boolean[] tempSave) { 38 | for(int i = 0; i < tempSave.length; i++) { 39 | tempSave[i] = false; 40 | } 41 | return tempSave; 42 | } 43 | } -------------------------------------------------------------------------------- /test/jsymbolic2/configuration/resources/invalidConfiguration.txt: -------------------------------------------------------------------------------- 1 | 2 | Acoustic Guitar Fractio 3 | Duration 4 | Beat Histogram 5 | 6 | ./invalid.midi 7 | ./test/jsymbolic2/features/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei 8 | 9 | window_size0 10 | window_overlap=0.1 11 | save_features_for_each_window=true 12 | save_overall_recording_features=false 13 | convert_to_arff=false 14 | convert_to_csv=false 15 | 16 | feature_values_save_pathtest_value.xml 17 | feature_definitions_save_path=test_definition.xml 18 | -------------------------------------------------------------------------------- /test/jsymbolic2/configuration/resources/invalidConfiguration.txt~: -------------------------------------------------------------------------------- 1 | 2 | AcousticGuitarFractionFeature 3 | DurationFeature 4 | BeatHistogramFeatue 5 | 6 | ./invalid.midi 7 | ./test/jsymbolic/features/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei 8 | 9 | window_size0 10 | window_overlap=0.1 11 | save_features_for_each_window=true 12 | save_overall_recording_features=false 13 | convert_to_arff=false 14 | convert_to_csv=false 15 | 16 | feature_values_save_pathtest_value.xml 17 | feature_definitions_save_path=test_definition.xml 18 | -------------------------------------------------------------------------------- /test/jsymbolic2/configuration/resources/invalidFileConfiguration.txt~: -------------------------------------------------------------------------------- 1 | 2 | AcousticGuitarFractionFeature 3 | DurationFeature 4 | BeatHistogramFeature 5 | 6 | ./invalid.midi 7 | ./test/jsymbolic/features/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei 8 | 9 | window_size=0 10 | window_overlap=0.1 11 | save_features_for_each_window=true 12 | save_overall_recording_features=false 13 | convert_to_arff=false 14 | convert_to_csv=false 15 | 16 | feature_values_save_path=test_value.xml 17 | feature_definitions_save_path=test_definition.xml 18 | -------------------------------------------------------------------------------- /test/jsymbolic2/configuration/resources/invalidOptionConfiguration.txt~: -------------------------------------------------------------------------------- 1 | 2 | AcousticGuitarFractionFeature 3 | DurationFeature 4 | BeatHistogramFeatue 5 | 6 | ./test/jsymbolic/features/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei 7 | ./invalid.midi 8 | 9 | window_size0 10 | window_overlap=0.1 11 | save_features_for_each_window=true 12 | save_overall_recording_features=false 13 | convert_to_arff=false 14 | convert_to_csv=false 15 | -------------------------------------------------------------------------------- /test/jsymbolic2/configuration/resources/noIOConfiguration.txt: -------------------------------------------------------------------------------- 1 | 2 | Acoustic Guitar Prevalence 3 | Duration 4 | Beat Histogram 5 | 6 | window_size=1.5 7 | window_overlap=0.1 8 | save_features_for_each_window=true 9 | save_overall_recording_features=false 10 | convert_to_arff=false 11 | convert_to_csv=false 12 | -------------------------------------------------------------------------------- /test/jsymbolic2/configuration/resources/noIOConfiguration.txt~: -------------------------------------------------------------------------------- 1 | 2 | AcousticGuitarFractionFeature 3 | DurationFeature 4 | BeatHistogramFeature 5 | 6 | window_size=1.5 7 | window_overlap=0.1 8 | save_features_for_each_window=true 9 | save_overall_recording_features=false 10 | convert_to_arff=false 11 | convert_to_csv=false 12 | -------------------------------------------------------------------------------- /test/jsymbolic2/configuration/resources/sampleConfiguration.txt: -------------------------------------------------------------------------------- 1 | 2 | Acoustic Guitar Prevalence 3 | Duration 4 | Beat Histogram 5 | 6 | window_size=1.5 7 | window_overlap=0.1 8 | save_features_for_each_window=true 9 | save_overall_recording_features=false 10 | convert_to_arff=false 11 | convert_to_csv=false 12 | 13 | feature_values_save_path=test_value.xml 14 | feature_definitions_save_path=test_definition.xml 15 | 16 | ./test/jsymbolic2/features/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei 17 | -------------------------------------------------------------------------------- /test/jsymbolic2/configuration/resources/sampleConfiguration.txt~: -------------------------------------------------------------------------------- 1 | 2 | Acoustic Guitar Fraction 3 | Duration 4 | BeatHistogramFeature 5 | 6 | window_size=1.5 7 | window_overlap=0.1 8 | save_features_for_each_window=true 9 | save_overall_recording_features=false 10 | convert_to_arff=false 11 | convert_to_csv=false 12 | 13 | feature_values_save_path=test_value.xml 14 | feature_definitions_save_path=test_definition.xml 15 | 16 | ./test/jsymbolic/features/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei 17 | -------------------------------------------------------------------------------- /test/jsymbolic2/configuration/resources/sampleConfiguration2.txt: -------------------------------------------------------------------------------- 1 | 2 | Acoustic Guitar Prevalence 3 | Duration 4 | Beat Histogram 5 | 6 | ./test/jsymbolic/features/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei 7 | 8 | window_size=1.5 9 | window_overlap=0.1 10 | save_features_for_each_window=true 11 | save_overall_recording_features=false 12 | convert_to_arff=false 13 | convert_to_csv=false 14 | 15 | feature_values_save_path=test_value.xml 16 | feature_definitions_save_path=test_definition.xml 17 | -------------------------------------------------------------------------------- /test/jsymbolic2/configuration/resources/sampleConfiguration2.txt~: -------------------------------------------------------------------------------- 1 | 2 | AcousticGuitarFractionFeature 3 | DurationFeature 4 | BeatHistogramFeature 5 | 6 | ./test/jsymbolic/features/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei 7 | 8 | window_size=1.5 9 | window_overlap=0.1 10 | save_features_for_each_window=true 11 | save_overall_recording_features=false 12 | convert_to_arff=false 13 | convert_to_csv=false 14 | 15 | feature_values_save_path=test_value.xml 16 | feature_definitions_save_path=test_definition.xml 17 | -------------------------------------------------------------------------------- /test/jsymbolic2/configuration/txtimplementation/ConfigurationOptionsEnumTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.configuration.txtimplementation; 2 | 3 | import jsymbolic2.configurationfile.EnumWindowingAndOutputFormatSettings; 4 | import org.junit.After; 5 | import org.junit.Before; 6 | import org.junit.Test; 7 | 8 | import static org.junit.Assert.*; 9 | 10 | /** 11 | * Created by dinamix on 5/17/16. 12 | */ 13 | public class ConfigurationOptionsEnumTest { 14 | @Before 15 | public void setUp() throws Exception { 16 | 17 | } 18 | 19 | @After 20 | public void tearDown() throws Exception { 21 | 22 | } 23 | 24 | @Test 25 | public void contains() throws Exception { 26 | assertTrue(EnumWindowingAndOutputFormatSettings.contains("window_size")); 27 | assertTrue(EnumWindowingAndOutputFormatSettings.contains("window_overlap")); 28 | assertTrue(EnumWindowingAndOutputFormatSettings.contains("save_features_for_each_window")); 29 | assertTrue(EnumWindowingAndOutputFormatSettings.contains("save_overall_recording_features")); 30 | assertTrue(EnumWindowingAndOutputFormatSettings.contains("convert_to_arff")); 31 | assertTrue(EnumWindowingAndOutputFormatSettings.contains("convert_to_csv")); 32 | } 33 | 34 | @Test 35 | public void checkValue() throws Exception { 36 | assertTrue(EnumWindowingAndOutputFormatSettings.window_size.checkValue("5")); 37 | assertTrue(EnumWindowingAndOutputFormatSettings.window_size.checkValue("0")); 38 | assertTrue(EnumWindowingAndOutputFormatSettings.window_overlap.checkValue("0.1")); 39 | assertTrue(EnumWindowingAndOutputFormatSettings.window_overlap.checkValue("0")); 40 | assertFalse(EnumWindowingAndOutputFormatSettings.window_overlap.checkValue("1.1")); 41 | assertTrue(EnumWindowingAndOutputFormatSettings.convert_to_arff.checkValue("false")); 42 | assertFalse(EnumWindowingAndOutputFormatSettings.window_size.checkValue("-1")); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/AverageNumberOfSimultaneousPitchClassesFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.AverageNumberOfSimultaneousPitchClassesFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 7/18/16. 17 | */ 18 | public class AverageNumberOfSimultaneousPitchClassesFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 0); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 1, 0); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 2, 0); 31 | t1_tracks.add(e_tracks3); 32 | t2_tracks.add(e_tracks2); 33 | t1_tracks.add(e_tracks4); 34 | t2_tracks.add(e_tracks1); 35 | t1_tracks.add(e_tracks5); 36 | t1_tracks.add(e_tracks6); 37 | 38 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 39 | MIDIFeatureExtractor actual_common = new AverageNumberOfSimultaneousPitchClassesFeature(); 40 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, null); 41 | double[] expected_chord_type = {2.5}; 42 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.001); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/AverageRestDurationPerVoiceFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.rhythm.AverageRestFractionAcrossVoicesFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 7/28/16. 17 | */ 18 | public class AverageRestDurationPerVoiceFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 1); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 1, 0); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(3, 0, 0); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(3, 1, 0); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 2, 0); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 3, 0); 31 | t1_tracks.add(e_tracks3); 32 | t2_tracks.add(e_tracks2); 33 | t1_tracks.add(e_tracks4); 34 | t2_tracks.add(e_tracks1); 35 | t1_tracks.add(e_tracks5); 36 | t1_tracks.add(e_tracks6); 37 | 38 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 39 | MIDIFeatureExtractor actual_common = new AverageRestFractionAcrossVoicesFeature(); 40 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, null); 41 | double[] expected_chord_type = {0.333}; 42 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.001); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/AverageVariabilityOfRestDurationsAcrossVoicesFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.rhythm.VariabilityAcrossVoicesOfCombinedRestsFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 7/28/16. 17 | */ 18 | public class AverageVariabilityOfRestDurationsAcrossVoicesFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 1); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 1); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 1, 1); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(3, 0, 0); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(3, 1, 0); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 3, 1); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 4, 1); 31 | MidiEvent e_tracks7 = MidiBuildEvent.createNoteOnEvent(7, 4, 0); 32 | MidiEvent e_tracks8 = MidiBuildEvent.createNoteOffEvent(7, 14, 0); 33 | t1_tracks.add(e_tracks3); 34 | t2_tracks.add(e_tracks2); 35 | t1_tracks.add(e_tracks4); 36 | t2_tracks.add(e_tracks1); 37 | t1_tracks.add(e_tracks5); 38 | t1_tracks.add(e_tracks6); 39 | t2_tracks.add(e_tracks7); 40 | t2_tracks.add(e_tracks8); 41 | 42 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 43 | MIDIFeatureExtractor actual_common = new VariabilityAcrossVoicesOfCombinedRestsFeature(); 44 | double[] actual_rest = actual_common.extractFeature(test_tracks, inter, null); 45 | double[] expected_rest = {2.82843}; 46 | assertArrayEquals(expected_rest, actual_rest, 0.00001); 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/ChordDurationFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.ChordTypeHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.ChordDurationFeature; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | import org.ddmal.midiUtilities.MidiBuildEvent; 8 | import org.junit.Test; 9 | 10 | import javax.sound.midi.MidiEvent; 11 | import javax.sound.midi.Sequence; 12 | import javax.sound.midi.Track; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * Created by dinamix on 7/18/16. 18 | */ 19 | public class ChordDurationFeatureTest { 20 | @Test 21 | public void extractFeature() throws Exception { 22 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 23 | Track t1_tracks = test_tracks.createTrack(); 24 | Track t2_tracks = test_tracks.createTrack(); 25 | //Velocities here are always 64 26 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 27 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 28 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 29 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 0); 30 | t1_tracks.add(e_tracks3); 31 | t2_tracks.add(e_tracks2); 32 | t1_tracks.add(e_tracks4); 33 | t2_tracks.add(e_tracks1); 34 | 35 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 36 | double[] vertical_intervals = new ChordTypeHistogramFeature().extractFeature(test_tracks, inter, null); 37 | double[][] other_features = new double[1][]; 38 | other_features[0] = vertical_intervals; 39 | MIDIFeatureExtractor actual_common = new ChordDurationFeature(); 40 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 41 | double[] expected_chord_type = {0.003906}; 42 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.000001); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/ChordTypesHistogramFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.ChordTypeHistogramFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 7/8/16. 17 | */ 18 | public class ChordTypesHistogramFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 3, 0); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 3, 0); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 0, 0); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 3, 0); 31 | t1_tracks.add(e_tracks3); 32 | t2_tracks.add(e_tracks2); 33 | t1_tracks.add(e_tracks4); 34 | t2_tracks.add(e_tracks1); 35 | t1_tracks.add(e_tracks5); 36 | t1_tracks.add(e_tracks6); 37 | 38 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 39 | 40 | MIDIFeatureExtractor actual_chordTypeFeature = new ChordTypeHistogramFeature(); 41 | double[] actual_chord_type = actual_chordTypeFeature.extractFeature(test_tracks, inter, null); 42 | double[] expected_chord_type = {0,0,1,0,0,0,0,0,0,0,0}; 43 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.001); 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/ComplexChordsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.ComplexChordsFeature; 4 | import jsymbolic2.features.verticalintervals.ChordTypeHistogramFeature; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | import org.ddmal.midiUtilities.MidiBuildEvent; 8 | import org.junit.Test; 9 | 10 | import javax.sound.midi.MidiEvent; 11 | import javax.sound.midi.Sequence; 12 | import javax.sound.midi.Track; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * Created by dinamix on 7/18/16. 18 | */ 19 | public class ComplexChordsFeatureTest { 20 | @Test 21 | public void extractFeature() throws Exception { 22 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 23 | Track t1_tracks = test_tracks.createTrack(); 24 | Track t2_tracks = test_tracks.createTrack(); 25 | //Velocities here are always 64 26 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 27 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 28 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 29 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 0); 30 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 1, 0); 31 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 2, 0); 32 | MidiEvent e_tracks7 = MidiBuildEvent.createNoteOnEvent(10, 1, 0); 33 | MidiEvent e_tracks8 = MidiBuildEvent.createNoteOffEvent(10, 2, 0); 34 | MidiEvent e_tracks9 = MidiBuildEvent.createNoteOnEvent(11, 1, 0); 35 | MidiEvent e_tracks10 = MidiBuildEvent.createNoteOffEvent(11, 2, 0); 36 | t1_tracks.add(e_tracks3); 37 | t2_tracks.add(e_tracks2); 38 | t1_tracks.add(e_tracks4); 39 | t2_tracks.add(e_tracks1); 40 | t1_tracks.add(e_tracks5); 41 | t1_tracks.add(e_tracks6); 42 | t2_tracks.add(e_tracks7); 43 | t2_tracks.add(e_tracks8); 44 | t1_tracks.add(e_tracks9); 45 | t1_tracks.add(e_tracks10); 46 | 47 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 48 | double[] vertical_intervals = new ChordTypeHistogramFeature().extractFeature(test_tracks, inter, null); 49 | double[][] other_features = new double[1][]; 50 | other_features[0] = vertical_intervals; 51 | MIDIFeatureExtractor actual_common = new ComplexChordsFeature(); 52 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 53 | double[] expected_chord_type = {0.5}; 54 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.01); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/DiminishedAndAugmentedTriadsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.DiminishedAndAugmentedTriadsFeature; 4 | import jsymbolic2.features.verticalintervals.ChordTypeHistogramFeature; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | import org.ddmal.midiUtilities.MidiBuildEvent; 8 | import org.junit.Test; 9 | 10 | import javax.sound.midi.MidiEvent; 11 | import javax.sound.midi.Sequence; 12 | import javax.sound.midi.Track; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * Created by dinamix on 7/15/16. 18 | */ 19 | public class DiminishedAndAugmentedTriadsFeatureTest { 20 | @Test 21 | public void extractFeature() throws Exception { 22 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 23 | Track t1_tracks = test_tracks.createTrack(); 24 | Track t2_tracks = test_tracks.createTrack(); 25 | //Velocities here are always 64 26 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 27 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 28 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 29 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 0); 30 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(8, 1, 0); 31 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(8, 2, 0); 32 | t1_tracks.add(e_tracks3); 33 | t2_tracks.add(e_tracks2); 34 | t1_tracks.add(e_tracks4); 35 | t2_tracks.add(e_tracks1); 36 | t1_tracks.add(e_tracks5); 37 | t1_tracks.add(e_tracks6); 38 | 39 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 40 | double[] vertical_intervals = new ChordTypeHistogramFeature().extractFeature(test_tracks, inter, null); 41 | double[][] other_features = new double[1][]; 42 | other_features[0] = vertical_intervals; 43 | MIDIFeatureExtractor actual_common = new DiminishedAndAugmentedTriadsFeature(); 44 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 45 | double[] expected_chord_type = {0.5}; 46 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.01); 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/DominantSeventhChordsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.DominantSeventhChordsFeature; 4 | import jsymbolic2.features.verticalintervals.ChordTypeHistogramFeature; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | import org.ddmal.midiUtilities.MidiBuildEvent; 8 | import org.junit.Test; 9 | 10 | import javax.sound.midi.MidiEvent; 11 | import javax.sound.midi.Sequence; 12 | import javax.sound.midi.Track; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * Created by dinamix on 7/18/16. 18 | */ 19 | public class DominantSeventhChordsFeatureTest { 20 | @Test 21 | public void extractFeature() throws Exception { 22 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 23 | Track t1_tracks = test_tracks.createTrack(); 24 | Track t2_tracks = test_tracks.createTrack(); 25 | //Velocities here are always 64 26 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 27 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 28 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 29 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 0); 30 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 1, 0); 31 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 2, 0); 32 | MidiEvent e_tracks7 = MidiBuildEvent.createNoteOnEvent(10, 1, 0); 33 | MidiEvent e_tracks8 = MidiBuildEvent.createNoteOffEvent(10, 2, 0); 34 | t1_tracks.add(e_tracks3); 35 | t2_tracks.add(e_tracks2); 36 | t1_tracks.add(e_tracks4); 37 | t2_tracks.add(e_tracks1); 38 | t1_tracks.add(e_tracks5); 39 | t1_tracks.add(e_tracks6); 40 | t2_tracks.add(e_tracks7); 41 | t2_tracks.add(e_tracks8); 42 | 43 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 44 | double[] vertical_intervals = new ChordTypeHistogramFeature().extractFeature(test_tracks, inter, null); 45 | double[][] other_features = new double[1][]; 46 | other_features[0] = vertical_intervals; 47 | MIDIFeatureExtractor actual_common = new DominantSeventhChordsFeature(); 48 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 49 | double[] expected_chord_type = {0.5}; 50 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.01); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/EmbellishmentFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.melodicintervals.MelodicEmbellishmentsFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 8/1/16. 17 | */ 18 | public class EmbellishmentFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 3, 0); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 3, 0); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 4, 0); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(0, 4, 0); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(0, 7, 0); 31 | t1_tracks.add(e_tracks3); 32 | t2_tracks.add(e_tracks2); 33 | t1_tracks.add(e_tracks4); 34 | t2_tracks.add(e_tracks1); 35 | t1_tracks.add(e_tracks5); 36 | t1_tracks.add(e_tracks6); 37 | 38 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 39 | MIDIFeatureExtractor actual_common = new MelodicEmbellishmentsFeature(); 40 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, null); 41 | double[] expected_chord_type = {0.3333}; 42 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.0001); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/IncidenceOfCompleteRestsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.rhythm.CompleteRestsFractionFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 7/26/16. 17 | */ 18 | public class IncidenceOfCompleteRestsFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 1, 0); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(3, 0, 0); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(3, 1, 0); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 2, 0); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 3, 0); 31 | t1_tracks.add(e_tracks3); 32 | t2_tracks.add(e_tracks2); 33 | t1_tracks.add(e_tracks4); 34 | t2_tracks.add(e_tracks1); 35 | t1_tracks.add(e_tracks5); 36 | t1_tracks.add(e_tracks6); 37 | 38 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 39 | MIDIFeatureExtractor actual_common = new CompleteRestsFractionFeature(); 40 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, null); 41 | double[] expected_chord_type = {0.333}; 42 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.001); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/MaximumCompleteRestDurationFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.rhythm.LongestCompleteRestFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 7/26/16. 17 | */ 18 | public class MaximumCompleteRestDurationFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 1, 0); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(3, 0, 0); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(3, 1, 0); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 3, 0); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 4, 0); 31 | t1_tracks.add(e_tracks3); 32 | t2_tracks.add(e_tracks2); 33 | t1_tracks.add(e_tracks4); 34 | t2_tracks.add(e_tracks1); 35 | t1_tracks.add(e_tracks5); 36 | t1_tracks.add(e_tracks6); 37 | 38 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 39 | MIDIFeatureExtractor actual_common = new LongestCompleteRestFeature(); 40 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, null); 41 | double[] expected_chord_type = {0.003906}; 42 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.000001); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/MelodicPitchVarietyFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.melodicintervals.MelodicPitchVarietyFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 7/29/16. 17 | */ 18 | public class MelodicPitchVarietyFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 1, 0); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 2, 0); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 3, 0); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(0, 4, 0); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(0, 5, 0); 31 | t1_tracks.add(e_tracks3); 32 | t2_tracks.add(e_tracks2); 33 | t1_tracks.add(e_tracks4); 34 | t2_tracks.add(e_tracks1); 35 | t1_tracks.add(e_tracks5); 36 | t1_tracks.add(e_tracks6); 37 | 38 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 39 | MIDIFeatureExtractor actual_common = new MelodicPitchVarietyFeature(); 40 | double[] actual_variety = actual_common.extractFeature(test_tracks, inter, null); 41 | double[] expected_variety = {2}; 42 | assertArrayEquals(expected_variety, actual_variety, 0.1); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/MinorMajorTriadRatioFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.MinorMajorTriadRatioFeature; 4 | import jsymbolic2.features.verticalintervals.ChordTypeHistogramFeature; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | import org.ddmal.midiUtilities.MidiBuildEvent; 8 | import org.junit.Test; 9 | 10 | import javax.sound.midi.MidiEvent; 11 | import javax.sound.midi.Sequence; 12 | import javax.sound.midi.Track; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * Created by dinamix on 7/15/16. 18 | */ 19 | public class MinorMajorTriadRatioFeatureTest { 20 | @Test 21 | public void extractFeature() throws Exception { 22 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 23 | Track t1_tracks = test_tracks.createTrack(); 24 | Track t2_tracks = test_tracks.createTrack(); 25 | //Velocities here are always 64 26 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 27 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 28 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 29 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 0); 30 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 1, 0); 31 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 2, 0); 32 | t1_tracks.add(e_tracks3); 33 | t2_tracks.add(e_tracks2); 34 | t1_tracks.add(e_tracks4); 35 | t2_tracks.add(e_tracks1); 36 | t1_tracks.add(e_tracks5); 37 | t1_tracks.add(e_tracks6); 38 | 39 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 40 | double[] vertical_intervals = new ChordTypeHistogramFeature().extractFeature(test_tracks, inter, null); 41 | double[][] other_features = new double[1][]; 42 | other_features[0] = vertical_intervals; 43 | MIDIFeatureExtractor actual_common = new MinorMajorTriadRatioFeature(); 44 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 45 | double[] expected_chord_type = {0}; 46 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.01); 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/MostCommonVerticalIntervalFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.WrappedVerticalIntervalHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 5 | import jsymbolic2.features.verticalintervals.MostCommonVerticalIntervalFeature; 6 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 7 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 8 | import org.ddmal.midiUtilities.MidiBuildEvent; 9 | import org.junit.After; 10 | import org.junit.Before; 11 | import org.junit.Test; 12 | 13 | import javax.sound.midi.MidiEvent; 14 | import javax.sound.midi.Sequence; 15 | import javax.sound.midi.Track; 16 | 17 | import static org.junit.Assert.*; 18 | 19 | /** 20 | * Created by dinamix on 7/13/16. 21 | */ 22 | public class MostCommonVerticalIntervalFeatureTest { 23 | @Before 24 | public void setUp() throws Exception { 25 | 26 | } 27 | 28 | @After 29 | public void tearDown() throws Exception { 30 | 31 | } 32 | 33 | @Test 34 | public void extractFeature() throws Exception { 35 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 36 | Track t1_tracks = test_tracks.createTrack(); 37 | Track t2_tracks = test_tracks.createTrack(); 38 | //Velocities here are always 64 39 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 40 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 3, 0); 41 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 42 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 1, 0); 43 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 0, 0); 44 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 3, 0); 45 | t1_tracks.add(e_tracks3); 46 | t2_tracks.add(e_tracks2); 47 | t1_tracks.add(e_tracks4); 48 | t2_tracks.add(e_tracks1); 49 | t1_tracks.add(e_tracks5); 50 | t1_tracks.add(e_tracks6); 51 | 52 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 53 | 54 | double[] unwrapped_vertical_intervals = new VerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, null); 55 | double[][] vertical_interval_other_features = new double[1][]; 56 | vertical_interval_other_features[0] = unwrapped_vertical_intervals; 57 | MIDIFeatureExtractor actual_common = new MostCommonVerticalIntervalFeature(); 58 | double[] vertical_intervals = new WrappedVerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, vertical_interval_other_features); 59 | double[][] other_features = new double[1][]; 60 | other_features[0] = vertical_intervals; 61 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 62 | double[] expected_chord_type = {7}; 63 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.001); 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/NonStandardChordsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.NonStandardChordsFeature; 4 | import jsymbolic2.features.verticalintervals.ChordTypeHistogramFeature; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | import org.ddmal.midiUtilities.MidiBuildEvent; 8 | import org.junit.Test; 9 | 10 | import javax.sound.midi.MidiEvent; 11 | import javax.sound.midi.Sequence; 12 | import javax.sound.midi.Track; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * Created by dinamix on 7/18/16. 18 | */ 19 | public class NonStandardChordsFeatureTest { 20 | @Test 21 | public void extractFeature() throws Exception { 22 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 23 | Track t1_tracks = test_tracks.createTrack(); 24 | Track t2_tracks = test_tracks.createTrack(); 25 | //Velocities here are always 64 26 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 27 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 28 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 29 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 0); 30 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 0, 0); 31 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 2, 0); 32 | MidiEvent e_tracks7 = MidiBuildEvent.createNoteOnEvent(1, 1, 0); 33 | MidiEvent e_tracks8 = MidiBuildEvent.createNoteOffEvent(1, 2, 0); 34 | MidiEvent e_tracks9 = MidiBuildEvent.createNoteOnEvent(2, 1, 0); 35 | MidiEvent e_tracks10 = MidiBuildEvent.createNoteOffEvent(2, 2, 0); 36 | t1_tracks.add(e_tracks3); 37 | t2_tracks.add(e_tracks2); 38 | t1_tracks.add(e_tracks4); 39 | t2_tracks.add(e_tracks1); 40 | t1_tracks.add(e_tracks5); 41 | t1_tracks.add(e_tracks6); 42 | t2_tracks.add(e_tracks7); 43 | t2_tracks.add(e_tracks8); 44 | t1_tracks.add(e_tracks9); 45 | t1_tracks.add(e_tracks10); 46 | 47 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 48 | double[] vertical_intervals = new ChordTypeHistogramFeature().extractFeature(test_tracks, inter, null); 49 | double[][] other_features = new double[1][]; 50 | other_features[0] = vertical_intervals; 51 | MIDIFeatureExtractor actual_common = new NonStandardChordsFeature(); 52 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 53 | double[] expected_chord_type = {0.5}; 54 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.01); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/NoteDensityVariabilityFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.rhythm.NoteDensityVariabilityFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 7/29/16. 17 | */ 18 | public class NoteDensityVariabilityFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 1); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(5, 0, 0); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(5, 2, 0); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 1); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 1); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(10, 13, 1); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(10, 14, 1); 31 | t1_tracks.add(e_tracks3); 32 | t2_tracks.add(e_tracks2); 33 | t1_tracks.add(e_tracks4); 34 | t2_tracks.add(e_tracks1); 35 | t1_tracks.add(e_tracks5); 36 | t1_tracks.add(e_tracks6); 37 | 38 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 39 | MIDIFeatureExtractor actual_common = new NoteDensityVariabilityFeature(); 40 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, null); 41 | double[] expected_chord_type = {1.06066}; 42 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.0001); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/NumberOfGraceNotesFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.meispecific.NumberOfGraceNotesMeiFeature; 4 | import jsymbolic2.featureutils.MEIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.jmei2midi.MeiSequence; 7 | import org.ddmal.jmei2midi.meielements.meispecific.MeiSpecificStorage; 8 | import org.junit.After; 9 | import org.junit.Before; 10 | import org.junit.Test; 11 | 12 | import java.io.File; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * Created by dinamix on 7/18/16. 18 | */ 19 | public class NumberOfGraceNotesFeatureTest { 20 | File saint_saens; 21 | MeiSequence sequence; 22 | MeiSpecificStorage specificStorage; 23 | @Before 24 | public void setUp() throws Exception { 25 | saint_saens = new File("./test/jsymbolic2/features/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei"); 26 | sequence = new MeiSequence(saint_saens); 27 | specificStorage = sequence.getNonMidiStorage(); 28 | } 29 | 30 | @After 31 | public void tearDown() throws Exception { 32 | 33 | } 34 | 35 | @Test 36 | public void extractMEIFeature() throws Exception { 37 | MEIFeatureExtractor graceNotesFeature = new NumberOfGraceNotesMeiFeature(); 38 | MIDIIntermediateRepresentations minter = new MIDIIntermediateRepresentations(sequence.getSequence()); 39 | double[] actualGraceNotes = graceNotesFeature.extractMEIFeature(specificStorage, sequence.getSequence(), minter, null); 40 | double[] expectedGraceNotes = new double[]{0}; 41 | assertArrayEquals(expectedGraceNotes, actualGraceNotes, 0.001); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/NumberOfSlurNotesFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.meispecific.NumberOfSlursMeiFeature; 4 | import jsymbolic2.featureutils.MEIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.jmei2midi.MeiSequence; 7 | import org.ddmal.jmei2midi.meielements.meispecific.MeiSpecificStorage; 8 | import org.junit.After; 9 | import org.junit.Before; 10 | import org.junit.Test; 11 | 12 | import java.io.File; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * Created by dinamix on 7/18/16. 18 | */ 19 | public class NumberOfSlurNotesFeatureTest { 20 | File saint_saens; 21 | MeiSequence sequence; 22 | MeiSpecificStorage specificStorage; 23 | @Before 24 | public void setUp() throws Exception { 25 | saint_saens = new File("./test/jsymbolic2/features/resources/Saint-Saens_LeCarnevalDesAnimmaux.mei"); 26 | sequence = new MeiSequence(saint_saens); 27 | specificStorage = sequence.getNonMidiStorage(); 28 | } 29 | 30 | @After 31 | public void tearDown() throws Exception { 32 | 33 | } 34 | 35 | @Test 36 | public void extractMEIFeature() throws Exception { 37 | MEIFeatureExtractor slurNotesFeature = new NumberOfSlursMeiFeature(); 38 | MIDIIntermediateRepresentations minter = new MIDIIntermediateRepresentations(sequence.getSequence()); 39 | double[] actualSlurNotes = slurNotesFeature.extractMEIFeature(specificStorage, sequence.getSequence(), minter, null); 40 | double[] expectedSlurNotes = new double[]{0.1154}; 41 | assertArrayEquals(expectedSlurNotes, actualSlurNotes, 0.001); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/ParallelMotionFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.texture.ParallelMotionFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 8/1/16. 17 | */ 18 | public class ParallelMotionFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 11, 0); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 11, 0); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(2, 12, 1); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(2, 24, 1); 31 | MidiEvent e_tracks7 = MidiBuildEvent.createNoteOnEvent(6, 12, 1); 32 | MidiEvent e_tracks8 = MidiBuildEvent.createNoteOffEvent(6, 24, 1); 33 | MidiEvent e_tracks9 = MidiBuildEvent.createNoteOnEvent(7, 25, 0); 34 | MidiEvent e_tracks10 = MidiBuildEvent.createNoteOffEvent(7, 30, 0); 35 | MidiEvent e_tracks13 = MidiBuildEvent.createNoteOnEvent(1, 25, 1); 36 | MidiEvent e_tracks14 = MidiBuildEvent.createNoteOffEvent(1, 30, 1); 37 | t1_tracks.add(e_tracks3); 38 | t2_tracks.add(e_tracks2); 39 | t1_tracks.add(e_tracks4); 40 | t2_tracks.add(e_tracks1); 41 | t1_tracks.add(e_tracks5); 42 | t1_tracks.add(e_tracks6); 43 | t2_tracks.add(e_tracks7); 44 | t2_tracks.add(e_tracks8); 45 | t1_tracks.add(e_tracks9); 46 | t1_tracks.add(e_tracks10); 47 | t2_tracks.add(e_tracks13); 48 | t2_tracks.add(e_tracks14); 49 | 50 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 51 | MIDIFeatureExtractor actual_common = new ParallelMotionFeature(); 52 | double[] actual_value = actual_common.extractFeature(test_tracks, inter, null); 53 | double[] expected_value = {0.5}; 54 | assertArrayEquals(expected_value, actual_value, 0.0001); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/PartialChordsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.PartialChordsFeature; 4 | import jsymbolic2.features.verticalintervals.ChordTypeHistogramFeature; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | import org.ddmal.midiUtilities.MidiBuildEvent; 8 | import org.junit.Test; 9 | 10 | import javax.sound.midi.MidiEvent; 11 | import javax.sound.midi.Sequence; 12 | import javax.sound.midi.Track; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * Created by dinamix on 7/15/16. 18 | */ 19 | public class PartialChordsFeatureTest { 20 | @Test 21 | public void extractFeature() throws Exception { 22 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 23 | Track t1_tracks = test_tracks.createTrack(); 24 | Track t2_tracks = test_tracks.createTrack(); 25 | //Velocities here are always 64 26 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 27 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 28 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 29 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 0); 30 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 1, 0); 31 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 2, 0); 32 | t1_tracks.add(e_tracks3); 33 | t2_tracks.add(e_tracks2); 34 | t1_tracks.add(e_tracks4); 35 | t2_tracks.add(e_tracks1); 36 | t1_tracks.add(e_tracks5); 37 | t1_tracks.add(e_tracks6); 38 | 39 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 40 | double[] vertical_intervals = new ChordTypeHistogramFeature().extractFeature(test_tracks, inter, null); 41 | double[][] other_features = new double[1][]; 42 | other_features[0] = vertical_intervals; 43 | MIDIFeatureExtractor actual_common = new PartialChordsFeature(); 44 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 45 | double[] expected_chord_type = {0.5}; 46 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.01); 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/PerfectVerticalIntervalsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.WrappedVerticalIntervalHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 5 | import jsymbolic2.features.verticalintervals.PerfectVerticalIntervalsFeature; 6 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 7 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 8 | import org.ddmal.midiUtilities.MidiBuildEvent; 9 | import org.junit.After; 10 | import org.junit.Before; 11 | import org.junit.Test; 12 | 13 | import javax.sound.midi.MidiEvent; 14 | import javax.sound.midi.Sequence; 15 | import javax.sound.midi.Track; 16 | 17 | import static org.junit.Assert.*; 18 | 19 | /** 20 | * Created by dinamix on 7/13/16. 21 | */ 22 | public class PerfectVerticalIntervalsFeatureTest { 23 | @Before 24 | public void setUp() throws Exception { 25 | 26 | } 27 | 28 | @After 29 | public void tearDown() throws Exception { 30 | 31 | } 32 | 33 | @Test 34 | public void extractFeature() throws Exception { 35 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 36 | Track t1_tracks = test_tracks.createTrack(); 37 | Track t2_tracks = test_tracks.createTrack(); 38 | //Velocities here are always 64 39 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 40 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 3, 0); 41 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(5, 0, 0); 42 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(5, 1, 0); 43 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 0, 0); 44 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 3, 0); 45 | t1_tracks.add(e_tracks3); 46 | t2_tracks.add(e_tracks2); 47 | t1_tracks.add(e_tracks4); 48 | t2_tracks.add(e_tracks1); 49 | t1_tracks.add(e_tracks5); 50 | t1_tracks.add(e_tracks6); 51 | 52 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 53 | double[] unwrapped_vertical_intervals = new VerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, null); 54 | double[][] vertical_interval_other_features = new double[1][]; 55 | vertical_interval_other_features[0] = unwrapped_vertical_intervals; 56 | double[] vertical_intervals = new WrappedVerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, vertical_interval_other_features); 57 | double[][] other_features = new double[1][]; 58 | other_features[0] = vertical_intervals; 59 | MIDIFeatureExtractor actual_common = new PerfectVerticalIntervalsFeature(); 60 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 61 | double[] expected_chord_type = {0.8}; 62 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.01); 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/PrevalenceOfMicroTonesFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.pitchstatistics.MicrotonePrevalenceFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.junit.Test; 7 | 8 | import javax.sound.midi.*; 9 | 10 | import java.io.File; 11 | 12 | import static org.junit.Assert.*; 13 | 14 | /** 15 | * Created by dinamix on 7/29/16. 16 | */ 17 | public class PrevalenceOfMicroTonesFeatureTest { 18 | @Test 19 | public void extractFeature() throws Exception { 20 | File britten = new File("./test/jsymbolic2/features/resources/Britten_-_Serenade_prologue.midi"); 21 | Sequence test_tracks = MidiSystem.getSequence(britten); 22 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 23 | 24 | MIDIFeatureExtractor common_interval_feature = new MicrotonePrevalenceFeature(); 25 | double[] actual_prevalence = common_interval_feature.extractFeature(test_tracks, inter, null); 26 | double[] expected_prevalence = {0.5273}; 27 | assertArrayEquals(expected_prevalence, actual_prevalence, 0.0001); 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/RelativeRangeIsolationOfLoudestVoiceFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.texture.RelativeRangeIsolationOfLoudestVoiceFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 7/25/16. 17 | */ 18 | public class RelativeRangeIsolationOfLoudestVoiceFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEventVel(0, 0, 0, 100); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 1); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 1); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEventVel(7, 1, 1, 50); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 2, 1); 31 | t1_tracks.add(e_tracks3); 32 | t2_tracks.add(e_tracks2); 33 | t1_tracks.add(e_tracks4); 34 | t2_tracks.add(e_tracks1); 35 | t1_tracks.add(e_tracks5); 36 | t1_tracks.add(e_tracks6); 37 | 38 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 39 | MIDIFeatureExtractor actual_common = new RelativeRangeIsolationOfLoudestVoiceFeature(); 40 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, null); 41 | double[] expected_chord_type = {1}; 42 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.001); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/SeventhChordsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.SeventhChordsFeature; 4 | import jsymbolic2.features.verticalintervals.ChordTypeHistogramFeature; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | import org.ddmal.midiUtilities.MidiBuildEvent; 8 | import org.junit.Test; 9 | 10 | import javax.sound.midi.MidiEvent; 11 | import javax.sound.midi.Sequence; 12 | import javax.sound.midi.Track; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * Created by dinamix on 7/18/16. 18 | */ 19 | public class SeventhChordsFeatureTest { 20 | @Test 21 | public void extractFeature() throws Exception { 22 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 23 | Track t1_tracks = test_tracks.createTrack(); 24 | Track t2_tracks = test_tracks.createTrack(); 25 | //Velocities here are always 64 26 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 27 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 28 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 29 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 0); 30 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 1, 0); 31 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 2, 0); 32 | MidiEvent e_tracks7 = MidiBuildEvent.createNoteOnEvent(10, 1, 0); 33 | MidiEvent e_tracks8 = MidiBuildEvent.createNoteOffEvent(10, 2, 0); 34 | t1_tracks.add(e_tracks3); 35 | t2_tracks.add(e_tracks2); 36 | t1_tracks.add(e_tracks4); 37 | t2_tracks.add(e_tracks1); 38 | t1_tracks.add(e_tracks5); 39 | t1_tracks.add(e_tracks6); 40 | t2_tracks.add(e_tracks7); 41 | t2_tracks.add(e_tracks8); 42 | 43 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 44 | double[] vertical_intervals = new ChordTypeHistogramFeature().extractFeature(test_tracks, inter, null); 45 | double[][] other_features = new double[1][]; 46 | other_features[0] = vertical_intervals; 47 | MIDIFeatureExtractor actual_common = new SeventhChordsFeature(); 48 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 49 | double[] expected_chord_type = {0.5}; 50 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.01); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/StandardTriadsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.StandardTriadsFeature; 4 | import jsymbolic2.features.verticalintervals.ChordTypeHistogramFeature; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | import org.ddmal.midiUtilities.MidiBuildEvent; 8 | import org.junit.Test; 9 | 10 | import javax.sound.midi.MidiEvent; 11 | import javax.sound.midi.Sequence; 12 | import javax.sound.midi.Track; 13 | 14 | import static org.junit.Assert.*; 15 | 16 | /** 17 | * Created by dinamix on 7/15/16. 18 | */ 19 | public class StandardTriadsFeatureTest { 20 | @Test 21 | public void extractFeature() throws Exception { 22 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 23 | Track t1_tracks = test_tracks.createTrack(); 24 | Track t2_tracks = test_tracks.createTrack(); 25 | //Velocities here are always 64 26 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 27 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 28 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(3, 0, 0); 29 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(3, 2, 0); 30 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 1, 0); 31 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 2, 0); 32 | MidiEvent e_tracks7 = MidiBuildEvent.createNoteOnEvent(6, 0, 0); 33 | MidiEvent e_tracks8 = MidiBuildEvent.createNoteOffEvent(6, 1, 0); 34 | t1_tracks.add(e_tracks3); 35 | t2_tracks.add(e_tracks2); 36 | t1_tracks.add(e_tracks4); 37 | t2_tracks.add(e_tracks1); 38 | t1_tracks.add(e_tracks5); 39 | t1_tracks.add(e_tracks6); 40 | t2_tracks.add(e_tracks7); 41 | t2_tracks.add(e_tracks8); 42 | 43 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 44 | double[] vertical_intervals = new ChordTypeHistogramFeature().extractFeature(test_tracks, inter, null); 45 | double[][] other_features = new double[1][]; 46 | other_features[0] = vertical_intervals; 47 | MIDIFeatureExtractor actual_common = new StandardTriadsFeature(); 48 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 49 | double[] expected_chord_type = {0.5}; 50 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.01); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/UnisonsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.WrappedVerticalIntervalHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.VerticalMinorSecondsFeature; 5 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 6 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 7 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 8 | import org.ddmal.midiUtilities.MidiBuildEvent; 9 | import org.junit.Test; 10 | 11 | import javax.sound.midi.MidiEvent; 12 | import javax.sound.midi.Sequence; 13 | import javax.sound.midi.Track; 14 | 15 | import static org.junit.Assert.*; 16 | 17 | /** 18 | * Created by dinamix on 7/15/16. 19 | */ 20 | public class UnisonsFeatureTest { 21 | @Test 22 | public void extractFeature() throws Exception { 23 | //Test for track unisons 24 | Sequence test_uni = new Sequence(Sequence.PPQ, 256); 25 | Track uni1_tracks = test_uni.createTrack(); 26 | Track uni2_tracks = test_uni.createTrack(); 27 | //Velocities here are always 64 28 | MidiEvent uni_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 29 | MidiEvent uni_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 30 | MidiEvent uni_tracks1 = MidiBuildEvent.createNoteOnEvent(1, 1, 0); 31 | MidiEvent uni_tracks2 = MidiBuildEvent.createNoteOffEvent(1, 2, 0); 32 | MidiEvent uni_tracks5 = MidiBuildEvent.createNoteOnEvent(3, 0, 0); 33 | MidiEvent uni_tracks6 = MidiBuildEvent.createNoteOffEvent(3, 1, 0); 34 | uni1_tracks.add(uni_tracks3); 35 | uni2_tracks.add(uni_tracks2); 36 | uni1_tracks.add(uni_tracks4); 37 | uni2_tracks.add(uni_tracks1); 38 | uni1_tracks.add(uni_tracks5); 39 | uni1_tracks.add(uni_tracks6); 40 | 41 | MIDIIntermediateRepresentations actual_representation_unison = new MIDIIntermediateRepresentations(test_uni); 42 | double[] unwrapped_vertical_intervals = new VerticalIntervalHistogramFeature().extractFeature(test_uni, actual_representation_unison, null); 43 | double[][] vertical_interval_other_features = new double[1][]; 44 | vertical_interval_other_features[0] = unwrapped_vertical_intervals; 45 | MIDIFeatureExtractor interval = new VerticalMinorSecondsFeature(); 46 | double[] vertical_intervals = new WrappedVerticalIntervalHistogramFeature().extractFeature(test_uni, actual_representation_unison, vertical_interval_other_features); 47 | double[][] other_features = new double[1][]; 48 | other_features[0] = vertical_intervals; 49 | double[] actual_interval = interval.extractFeature(test_uni, actual_representation_unison, other_features); 50 | 51 | double[] expected_interval = new double[1]; 52 | expected_interval[0] = 0.5; 53 | 54 | assertArrayEquals(expected_interval, actual_interval, 0.0001); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/VariabilityOfNumberOfSimultaneousPitchClassesFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.VariabilityOfNumberOfSimultaneousPitchClassesFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 7/18/16. 17 | */ 18 | public class VariabilityOfNumberOfSimultaneousPitchClassesFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 0); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 1, 0); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 2, 0); 31 | t1_tracks.add(e_tracks3); 32 | t2_tracks.add(e_tracks2); 33 | t1_tracks.add(e_tracks4); 34 | t2_tracks.add(e_tracks1); 35 | t1_tracks.add(e_tracks5); 36 | t1_tracks.add(e_tracks6); 37 | 38 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 39 | MIDIFeatureExtractor actual_common = new VariabilityOfNumberOfSimultaneousPitchClassesFeature(); 40 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, null); 41 | double[] expected_chord_type = {0.7071}; 42 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.001); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/VerticalDissonanceRatioFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.WrappedVerticalIntervalHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 5 | import jsymbolic2.features.verticalintervals.VerticalDissonanceRatioFeature; 6 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 7 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 8 | import org.ddmal.midiUtilities.MidiBuildEvent; 9 | import org.junit.Test; 10 | 11 | import javax.sound.midi.MidiEvent; 12 | import javax.sound.midi.Sequence; 13 | import javax.sound.midi.Track; 14 | 15 | import static org.junit.Assert.*; 16 | 17 | /** 18 | * Created by dinamix on 7/18/16. 19 | */ 20 | public class VerticalDissonanceRatioFeatureTest { 21 | @Test 22 | public void extractFeature() throws Exception { 23 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 24 | Track t1_tracks = test_tracks.createTrack(); 25 | Track t2_tracks = test_tracks.createTrack(); 26 | //Velocities here are always 64 27 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(2, 0, 0); 28 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(2, 3, 0); 29 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(7, 0, 0); 30 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(7, 1, 0); 31 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(8, 1, 0); 32 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(8, 3, 0); 33 | t1_tracks.add(e_tracks3); 34 | t2_tracks.add(e_tracks2); 35 | t1_tracks.add(e_tracks4); 36 | t2_tracks.add(e_tracks1); 37 | t1_tracks.add(e_tracks5); 38 | t1_tracks.add(e_tracks6); 39 | 40 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 41 | double[] unwrapped_vertical_intervals = new VerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, null); 42 | double[][] vertical_interval_other_features = new double[1][]; 43 | vertical_interval_other_features[0] = unwrapped_vertical_intervals; 44 | MIDIFeatureExtractor actual_common = new VerticalDissonanceRatioFeature(); 45 | double[] vertical_intervals = new WrappedVerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, vertical_interval_other_features); 46 | double[][] other_features = new double[2][]; 47 | other_features[0] = vertical_intervals; 48 | double[] vertical = new VerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, null); 49 | other_features[1] = vertical; 50 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 51 | double[] expected_chord_type = {2}; 52 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.001); 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/VerticalFifthsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.WrappedVerticalIntervalHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.VerticalPerfectFifthsFeature; 5 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 6 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 7 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 8 | import org.ddmal.midiUtilities.MidiBuildEvent; 9 | import org.junit.Test; 10 | 11 | import javax.sound.midi.MidiEvent; 12 | import javax.sound.midi.Sequence; 13 | import javax.sound.midi.Track; 14 | 15 | import static org.junit.Assert.*; 16 | 17 | /** 18 | * Created by dinamix on 7/15/16. 19 | */ 20 | public class VerticalFifthsFeatureTest { 21 | @Test 22 | public void extractFeature() throws Exception { 23 | //Test for track unisons 24 | Sequence test_uni = new Sequence(Sequence.PPQ, 256); 25 | Track uni1_tracks = test_uni.createTrack(); 26 | Track uni2_tracks = test_uni.createTrack(); 27 | //Velocities here are always 64 28 | MidiEvent uni_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 29 | MidiEvent uni_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 30 | MidiEvent uni_tracks1 = MidiBuildEvent.createNoteOnEvent(7, 1, 0); 31 | MidiEvent uni_tracks2 = MidiBuildEvent.createNoteOffEvent(7, 2, 0); 32 | MidiEvent uni_tracks5 = MidiBuildEvent.createNoteOnEvent(3, 0, 0); 33 | MidiEvent uni_tracks6 = MidiBuildEvent.createNoteOffEvent(3, 1, 0); 34 | uni1_tracks.add(uni_tracks3); 35 | uni2_tracks.add(uni_tracks2); 36 | uni1_tracks.add(uni_tracks4); 37 | uni2_tracks.add(uni_tracks1); 38 | uni1_tracks.add(uni_tracks5); 39 | uni1_tracks.add(uni_tracks6); 40 | 41 | MIDIIntermediateRepresentations actual_representation_unison = new MIDIIntermediateRepresentations(test_uni); 42 | double[] unwrapped_vertical_intervals = new VerticalIntervalHistogramFeature().extractFeature(test_uni, actual_representation_unison, null); 43 | double[][] vertical_interval_other_features = new double[1][]; 44 | vertical_interval_other_features[0] = unwrapped_vertical_intervals; 45 | MIDIFeatureExtractor unison = new VerticalPerfectFifthsFeature(); 46 | double[] vertical_intervals = new WrappedVerticalIntervalHistogramFeature().extractFeature(test_uni, actual_representation_unison, vertical_interval_other_features); 47 | double[][] other_features = new double[1][]; 48 | other_features[0] = vertical_intervals; 49 | double[] actual_unison = unison.extractFeature(test_uni, actual_representation_unison, other_features); 50 | 51 | double[] expected_intervals = new double[1]; 52 | expected_intervals[0] = 0.5; 53 | 54 | assertArrayEquals(expected_intervals, actual_unison, 0.0001); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/VerticalIntervalWrappedHistogramFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.WrappedVerticalIntervalHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 5 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 6 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 7 | import org.ddmal.midiUtilities.MidiBuildEvent; 8 | import org.junit.After; 9 | import org.junit.Before; 10 | import org.junit.Test; 11 | 12 | import javax.sound.midi.MidiEvent; 13 | import javax.sound.midi.Sequence; 14 | import javax.sound.midi.Track; 15 | 16 | import static org.junit.Assert.*; 17 | 18 | /** 19 | * Created by dinamix on 7/6/16. 20 | */ 21 | public class VerticalIntervalWrappedHistogramFeatureTest { 22 | @Before 23 | public void setUp() throws Exception { 24 | 25 | } 26 | 27 | @After 28 | public void tearDown() throws Exception { 29 | 30 | } 31 | 32 | @Test 33 | public void extractFeature() throws Exception { 34 | //Test for tracks tracks 35 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 36 | Track t1_tracks = test_tracks.createTrack(); 37 | Track t2_tracks = test_tracks.createTrack(); 38 | //Velocities here are always 64 39 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 40 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 3, 0); 41 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(2, 1, 0); 42 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(2, 4, 0); 43 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(16, 2, 0); 44 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(16, 4, 0); 45 | t1_tracks.add(e_tracks3); 46 | t2_tracks.add(e_tracks2); 47 | t1_tracks.add(e_tracks4); 48 | t2_tracks.add(e_tracks1); 49 | t1_tracks.add(e_tracks5); 50 | t1_tracks.add(e_tracks6); 51 | 52 | MIDIFeatureExtractor vertical = new WrappedVerticalIntervalHistogramFeature(); 53 | MIDIIntermediateRepresentations actual_representation_tracks = new MIDIIntermediateRepresentations(test_tracks); 54 | double[] unwrapped_vertical_intervals = new VerticalIntervalHistogramFeature().extractFeature(test_tracks, actual_representation_tracks, null); 55 | double[][] vertical_interval_other_features = new double[1][]; 56 | vertical_interval_other_features[0] = unwrapped_vertical_intervals; 57 | double[] actual_vertical = vertical.extractFeature(test_tracks, actual_representation_tracks, vertical_interval_other_features); 58 | 59 | double[] expected_vertical = new double[12]; 60 | expected_vertical[2] = 0.8; 61 | expected_vertical[4] = 0.2; 62 | 63 | assertArrayEquals(expected_vertical, actual_vertical, 0.0001); 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/VerticalIntervalsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.After; 8 | import org.junit.Before; 9 | import org.junit.Test; 10 | 11 | import javax.sound.midi.MidiEvent; 12 | import javax.sound.midi.Sequence; 13 | import javax.sound.midi.Track; 14 | 15 | import static org.junit.Assert.*; 16 | 17 | /** 18 | * Created by dinamix on 7/6/16. 19 | */ 20 | public class VerticalIntervalsFeatureTest { 21 | @Before 22 | public void setUp() throws Exception { 23 | 24 | } 25 | 26 | @After 27 | public void tearDown() throws Exception { 28 | 29 | } 30 | 31 | @Test 32 | public void extractFeature() throws Exception { 33 | //Test for tracks tracks 34 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 35 | Track t1_tracks = test_tracks.createTrack(); 36 | Track t2_tracks = test_tracks.createTrack(); 37 | //Velocities here are always 64 38 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 39 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 3, 0); 40 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(2, 1, 0); 41 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(2, 4, 0); 42 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(4, 2, 0); 43 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(4, 4, 0); 44 | t1_tracks.add(e_tracks3); 45 | t2_tracks.add(e_tracks2); 46 | t1_tracks.add(e_tracks4); 47 | t2_tracks.add(e_tracks1); 48 | t1_tracks.add(e_tracks5); 49 | t1_tracks.add(e_tracks6); 50 | 51 | MIDIFeatureExtractor vertical = new VerticalIntervalHistogramFeature(); 52 | MIDIIntermediateRepresentations actual_representation_tracks = new MIDIIntermediateRepresentations(test_tracks); 53 | double[] actual_vertical = vertical.extractFeature(test_tracks, actual_representation_tracks, null); 54 | 55 | double[] expected_vertical = new double[128]; 56 | expected_vertical[2] = 0.8; 57 | expected_vertical[4] = 0.2; 58 | 59 | assertArrayEquals(expected_vertical, actual_vertical, 0.0001); 60 | } 61 | 62 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/VerticalMajorThirdPrevalenceFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.WrappedVerticalIntervalHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.VerticalMajorThirdPrevalenceFeature; 5 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 6 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 7 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 8 | import org.ddmal.midiUtilities.MidiBuildEvent; 9 | import org.junit.Test; 10 | 11 | import javax.sound.midi.MidiEvent; 12 | import javax.sound.midi.Sequence; 13 | import javax.sound.midi.Track; 14 | 15 | import static org.junit.Assert.*; 16 | 17 | /** 18 | * Created by dinamix on 7/29/16. 19 | */ 20 | public class VerticalMajorThirdPrevalenceFeatureTest { 21 | @Test 22 | public void extractFeature() throws Exception { 23 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 24 | Track t1_tracks = test_tracks.createTrack(); 25 | Track t2_tracks = test_tracks.createTrack(); 26 | //Velocities here are always 64 27 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 28 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 3, 0); 29 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 0); 30 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 1, 0); 31 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(8, 0, 0); 32 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(8, 3, 0); 33 | t1_tracks.add(e_tracks3); 34 | t2_tracks.add(e_tracks2); 35 | t1_tracks.add(e_tracks4); 36 | t2_tracks.add(e_tracks1); 37 | t1_tracks.add(e_tracks5); 38 | t1_tracks.add(e_tracks6); 39 | 40 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 41 | double[] unwrapped_vertical_intervals = new VerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, null); 42 | double[][] vertical_interval_other_features = new double[1][]; 43 | vertical_interval_other_features[0] = unwrapped_vertical_intervals; 44 | double[] vertical_intervals = new WrappedVerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, vertical_interval_other_features); 45 | double[][] other_features = new double[1][]; 46 | other_features[0] = vertical_intervals; 47 | MIDIFeatureExtractor actual_common = new VerticalMajorThirdPrevalenceFeature(); 48 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 49 | double[] expected_chord_type = {0.333}; 50 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.01); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/VerticalMinorSecondsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.WrappedVerticalIntervalHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.VerticalUnisonsFeature; 5 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 6 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 7 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 8 | import org.ddmal.midiUtilities.MidiBuildEvent; 9 | import org.junit.Test; 10 | 11 | import javax.sound.midi.MidiEvent; 12 | import javax.sound.midi.Sequence; 13 | import javax.sound.midi.Track; 14 | 15 | import static org.junit.Assert.*; 16 | 17 | /** 18 | * Created by dinamix on 7/15/16. 19 | */ 20 | public class VerticalMinorSecondsFeatureTest { 21 | @Test 22 | public void extractFeature() throws Exception { 23 | //Test for track unisons 24 | Sequence test_uni = new Sequence(Sequence.PPQ, 256); 25 | Track uni1_tracks = test_uni.createTrack(); 26 | Track uni2_tracks = test_uni.createTrack(); 27 | //Velocities here are always 64 28 | MidiEvent uni_tracks3 = MidiBuildEvent.createNoteOnEvent(1, 0, 0); 29 | MidiEvent uni_tracks4 = MidiBuildEvent.createNoteOffEvent(1, 2, 0); 30 | MidiEvent uni_tracks1 = MidiBuildEvent.createNoteOnEvent(1, 1, 0); 31 | MidiEvent uni_tracks2 = MidiBuildEvent.createNoteOffEvent(1, 2, 0); 32 | MidiEvent uni_tracks5 = MidiBuildEvent.createNoteOnEvent(3, 0, 0); 33 | MidiEvent uni_tracks6 = MidiBuildEvent.createNoteOffEvent(3, 1, 0); 34 | uni1_tracks.add(uni_tracks3); 35 | uni2_tracks.add(uni_tracks2); 36 | uni1_tracks.add(uni_tracks4); 37 | uni2_tracks.add(uni_tracks1); 38 | uni1_tracks.add(uni_tracks5); 39 | uni1_tracks.add(uni_tracks6); 40 | 41 | MIDIIntermediateRepresentations actual_representation_unison = new MIDIIntermediateRepresentations(test_uni); 42 | double[] unwrapped_vertical_intervals = new VerticalIntervalHistogramFeature().extractFeature(test_uni, actual_representation_unison, null); 43 | double[][] vertical_interval_other_features = new double[1][]; 44 | vertical_interval_other_features[0] = unwrapped_vertical_intervals; 45 | MIDIFeatureExtractor unison = new VerticalUnisonsFeature(); 46 | double[] vertical_intervals = new WrappedVerticalIntervalHistogramFeature().extractFeature(test_uni, actual_representation_unison, vertical_interval_other_features); 47 | double[][] other_features = new double[1][]; 48 | other_features[0] = vertical_intervals; 49 | double[] actual_unison = unison.extractFeature(test_uni, actual_representation_unison, other_features); 50 | 51 | double[] expected_unison = new double[1]; 52 | expected_unison[0] = 0.5; 53 | 54 | assertArrayEquals(expected_unison, actual_unison, 0.0001); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/VerticalMinorThirdPrevalenceFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.WrappedVerticalIntervalHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.VerticalMinorThirdPrevalenceFeature; 5 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 6 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 7 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 8 | import org.ddmal.midiUtilities.MidiBuildEvent; 9 | import org.junit.Test; 10 | 11 | import javax.sound.midi.MidiEvent; 12 | import javax.sound.midi.Sequence; 13 | import javax.sound.midi.Track; 14 | 15 | import static org.junit.Assert.*; 16 | 17 | /** 18 | * Created by dinamix on 7/29/16. 19 | */ 20 | public class VerticalMinorThirdPrevalenceFeatureTest { 21 | @Test 22 | public void extractFeature() throws Exception { 23 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 24 | Track t1_tracks = test_tracks.createTrack(); 25 | Track t2_tracks = test_tracks.createTrack(); 26 | //Velocities here are always 64 27 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 28 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 3, 0); 29 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(3, 0, 0); 30 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(3, 1, 0); 31 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(8, 0, 0); 32 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(8, 3, 0); 33 | t1_tracks.add(e_tracks3); 34 | t2_tracks.add(e_tracks2); 35 | t1_tracks.add(e_tracks4); 36 | t2_tracks.add(e_tracks1); 37 | t1_tracks.add(e_tracks5); 38 | t1_tracks.add(e_tracks6); 39 | 40 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 41 | double[] unwrapped_vertical_intervals = new VerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, null); 42 | double[][] vertical_interval_other_features = new double[1][]; 43 | vertical_interval_other_features[0] = unwrapped_vertical_intervals; 44 | double[] vertical_intervals = new WrappedVerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, vertical_interval_other_features); 45 | double[][] other_features = new double[1][]; 46 | other_features[0] = vertical_intervals; 47 | MIDIFeatureExtractor actual_common = new VerticalMinorThirdPrevalenceFeature(); 48 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 49 | double[] expected_chord_type = {0.333}; 50 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.01); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/VerticalOctavesFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.WrappedVerticalIntervalHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.VerticalOctavesFeature; 5 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 6 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 7 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 8 | import org.ddmal.midiUtilities.MidiBuildEvent; 9 | import org.junit.Test; 10 | 11 | import javax.sound.midi.MidiEvent; 12 | import javax.sound.midi.Sequence; 13 | import javax.sound.midi.Track; 14 | 15 | import static org.junit.Assert.*; 16 | 17 | /** 18 | * Created by dinamix on 7/15/16. 19 | */ 20 | public class VerticalOctavesFeatureTest { 21 | @Test 22 | public void extractFeature() throws Exception { 23 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 24 | Track t1_tracks = test_tracks.createTrack(); 25 | Track t2_tracks = test_tracks.createTrack(); 26 | //Velocities here are always 64 27 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(2, 0, 0); 28 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(2, 3, 0); 29 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(8, 0, 0); 30 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(8, 1, 0); 31 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(14, 0, 0); 32 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(14, 3, 0); 33 | t1_tracks.add(e_tracks3); 34 | t2_tracks.add(e_tracks2); 35 | t1_tracks.add(e_tracks4); 36 | t2_tracks.add(e_tracks1); 37 | t1_tracks.add(e_tracks5); 38 | t1_tracks.add(e_tracks6); 39 | 40 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 41 | double[] unwrapped_vertical_intervals = new VerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, null); 42 | double[][] other_features = new double[2][]; 43 | other_features[0] = unwrapped_vertical_intervals; 44 | MIDIFeatureExtractor actual_common = new VerticalOctavesFeature(); 45 | double[] vertical_intervals = new WrappedVerticalIntervalHistogramFeature().extractFeature(test_tracks, inter, other_features); 46 | other_features[0] = vertical_intervals; 47 | other_features[1] = unwrapped_vertical_intervals; 48 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, other_features); 49 | double[] expected_chord_type = {0.6}; 50 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.001); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/VerticalThirdsFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.WrappedVerticalIntervalHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.VerticalThirdsFeature; 5 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 6 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 7 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 8 | import org.ddmal.midiUtilities.MidiBuildEvent; 9 | import org.junit.Test; 10 | 11 | import javax.sound.midi.MidiEvent; 12 | import javax.sound.midi.Sequence; 13 | import javax.sound.midi.Track; 14 | 15 | import static org.junit.Assert.*; 16 | 17 | /** 18 | * Created by dinamix on 7/15/16. 19 | */ 20 | public class VerticalThirdsFeatureTest { 21 | @Test 22 | public void extractFeature() throws Exception { 23 | //Test for track unisons 24 | Sequence test_uni = new Sequence(Sequence.PPQ, 256); 25 | Track uni1_tracks = test_uni.createTrack(); 26 | Track uni2_tracks = test_uni.createTrack(); 27 | //Velocities here are always 64 28 | MidiEvent uni_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 29 | MidiEvent uni_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 30 | MidiEvent uni_tracks1 = MidiBuildEvent.createNoteOnEvent(5, 1, 0); 31 | MidiEvent uni_tracks2 = MidiBuildEvent.createNoteOffEvent(5, 2, 0); 32 | MidiEvent uni_tracks5 = MidiBuildEvent.createNoteOnEvent(3, 0, 0); 33 | MidiEvent uni_tracks6 = MidiBuildEvent.createNoteOffEvent(3, 1, 0); 34 | uni1_tracks.add(uni_tracks3); 35 | uni2_tracks.add(uni_tracks2); 36 | uni1_tracks.add(uni_tracks4); 37 | uni2_tracks.add(uni_tracks1); 38 | uni1_tracks.add(uni_tracks5); 39 | uni1_tracks.add(uni_tracks6); 40 | 41 | MIDIIntermediateRepresentations actual_representation_unison = new MIDIIntermediateRepresentations(test_uni); 42 | double[] unwrapped_vertical_intervals = new VerticalIntervalHistogramFeature().extractFeature(test_uni, actual_representation_unison, null); 43 | double[][] vertical_interval_other_features = new double[1][]; 44 | vertical_interval_other_features[0] = unwrapped_vertical_intervals; 45 | MIDIFeatureExtractor unison = new VerticalThirdsFeature(); 46 | double[] vertical_intervals = new WrappedVerticalIntervalHistogramFeature().extractFeature(test_uni, actual_representation_unison, vertical_interval_other_features); 47 | double[][] other_features = new double[1][]; 48 | other_features[0] = vertical_intervals; 49 | double[] actual_unison = unison.extractFeature(test_uni, actual_representation_unison, other_features); 50 | 51 | double[] expected_intervals = new double[1]; 52 | expected_intervals[0] = 0.5; 53 | 54 | assertArrayEquals(expected_intervals, actual_unison, 0.0001); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/VerticalTritonesFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.verticalintervals.WrappedVerticalIntervalHistogramFeature; 4 | import jsymbolic2.features.verticalintervals.VerticalTritonesFeature; 5 | import jsymbolic2.features.verticalintervals.VerticalIntervalHistogramFeature; 6 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 7 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 8 | import org.ddmal.midiUtilities.MidiBuildEvent; 9 | import org.junit.Test; 10 | 11 | import javax.sound.midi.MidiEvent; 12 | import javax.sound.midi.Sequence; 13 | import javax.sound.midi.Track; 14 | 15 | import static org.junit.Assert.*; 16 | 17 | /** 18 | * Created by dinamix on 7/15/16. 19 | */ 20 | public class VerticalTritonesFeatureTest { 21 | @Test 22 | public void extractFeature() throws Exception { 23 | //Test for track unisons 24 | Sequence test_uni = new Sequence(Sequence.PPQ, 256); 25 | Track uni1_tracks = test_uni.createTrack(); 26 | Track uni2_tracks = test_uni.createTrack(); 27 | //Velocities here are always 64 28 | MidiEvent uni_tracks3 = MidiBuildEvent.createNoteOnEvent(0, 0, 0); 29 | MidiEvent uni_tracks4 = MidiBuildEvent.createNoteOffEvent(0, 2, 0); 30 | MidiEvent uni_tracks1 = MidiBuildEvent.createNoteOnEvent(6, 1, 0); 31 | MidiEvent uni_tracks2 = MidiBuildEvent.createNoteOffEvent(6, 2, 0); 32 | MidiEvent uni_tracks5 = MidiBuildEvent.createNoteOnEvent(3, 0, 0); 33 | MidiEvent uni_tracks6 = MidiBuildEvent.createNoteOffEvent(3, 1, 0); 34 | uni1_tracks.add(uni_tracks3); 35 | uni2_tracks.add(uni_tracks2); 36 | uni1_tracks.add(uni_tracks4); 37 | uni2_tracks.add(uni_tracks1); 38 | uni1_tracks.add(uni_tracks5); 39 | uni1_tracks.add(uni_tracks6); 40 | 41 | MIDIIntermediateRepresentations actual_representation_unison = new MIDIIntermediateRepresentations(test_uni); 42 | double[] unwrapped_vertical_intervals = new VerticalIntervalHistogramFeature().extractFeature(test_uni, actual_representation_unison, null); 43 | double[][] vertical_interval_other_features = new double[1][]; 44 | vertical_interval_other_features[0] = unwrapped_vertical_intervals; 45 | MIDIFeatureExtractor unison = new VerticalTritonesFeature(); 46 | double[] vertical_intervals = new WrappedVerticalIntervalHistogramFeature().extractFeature(test_uni, actual_representation_unison, vertical_interval_other_features); 47 | double[][] other_features = new double[1][]; 48 | other_features[0] = vertical_intervals; 49 | double[] actual_unison = unison.extractFeature(test_uni, actual_representation_unison, other_features); 50 | 51 | double[] expected_intervals = new double[1]; 52 | expected_intervals[0] = 0.5; 53 | 54 | assertArrayEquals(expected_intervals, actual_unison, 0.0001); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/VoiceOverlapFeatureTest.java: -------------------------------------------------------------------------------- 1 | package jsymbolic2.features; 2 | 3 | import jsymbolic2.features.texture.VoiceOverlapFeature; 4 | import jsymbolic2.featureutils.MIDIFeatureExtractor; 5 | import jsymbolic2.processing.MIDIIntermediateRepresentations; 6 | import org.ddmal.midiUtilities.MidiBuildEvent; 7 | import org.junit.Test; 8 | 9 | import javax.sound.midi.MidiEvent; 10 | import javax.sound.midi.Sequence; 11 | import javax.sound.midi.Track; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by dinamix on 7/29/16. 17 | */ 18 | public class VoiceOverlapFeatureTest { 19 | @Test 20 | public void extractFeature() throws Exception { 21 | Sequence test_tracks = new Sequence(Sequence.PPQ, 256); 22 | Track t1_tracks = test_tracks.createTrack(); 23 | Track t2_tracks = test_tracks.createTrack(); 24 | //Velocities here are always 64 25 | MidiEvent e_tracks3 = MidiBuildEvent.createNoteOnEvent(5, 0, 0); 26 | MidiEvent e_tracks4 = MidiBuildEvent.createNoteOffEvent(5, 2, 0); 27 | MidiEvent e_tracks1 = MidiBuildEvent.createNoteOnEvent(4, 0, 1); 28 | MidiEvent e_tracks2 = MidiBuildEvent.createNoteOffEvent(4, 2, 1); 29 | MidiEvent e_tracks5 = MidiBuildEvent.createNoteOnEvent(7, 1, 1); 30 | MidiEvent e_tracks6 = MidiBuildEvent.createNoteOffEvent(7, 2, 1); 31 | t1_tracks.add(e_tracks3); 32 | t2_tracks.add(e_tracks2); 33 | t1_tracks.add(e_tracks4); 34 | t2_tracks.add(e_tracks1); 35 | t1_tracks.add(e_tracks5); 36 | t1_tracks.add(e_tracks6); 37 | 38 | MIDIIntermediateRepresentations inter = new MIDIIntermediateRepresentations(test_tracks); 39 | MIDIFeatureExtractor actual_common = new VoiceOverlapFeature(); 40 | double[] actual_chord_type = actual_common.extractFeature(test_tracks, inter, null); 41 | double[] expected_chord_type = {0.333}; 42 | assertArrayEquals(expected_chord_type, actual_chord_type, 0.001); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /test/jsymbolic2/features/resources/Britten_-_Serenade_prologue.midi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/test/jsymbolic2/features/resources/Britten_-_Serenade_prologue.midi -------------------------------------------------------------------------------- /tutorial/contents.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jSymbolic Tutorial Workshop Contents 5 | 6 | 7 | 8 | CONTENTS 9 | 10 |

Introduction

11 | 12 |

Installation

13 | 14 |

Running jSymbolic

15 | 16 |

jSymbolic Basics

17 | 18 |

Selecting Symnbolic Music

19 | 20 |

Working with Features

21 | 22 |

Examining Features

23 | 24 |

Configuration Files

25 | 26 |

Doing Some Real Research

27 | 28 |

Using Weka

29 | 30 |

Training a Model and Using It

31 | 32 |

Portuguese Research

33 | 34 |

jSymbolic Bits and Pieces

35 | 36 |

Final Words

37 | 38 | -------------------------------------------------------------------------------- /tutorial/home.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | jSymbolic Tutorial 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /tutorial/jSymbolicTutorialWorkingFiles.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/tutorial/jSymbolicTutorialWorkingFiles.zip -------------------------------------------------------------------------------- /tutorial/portugueseresearch.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DDMAL/jSymbolic2/0c465281d836f6ab6c66ca8762fa8811ebac730f/tutorial/portugueseresearch.html --------------------------------------------------------------------------------