Skip to content

Commit

Permalink
Enable recording name to be passed to spectrograms.
Browse files Browse the repository at this point in the history
Issue #278 Enable recording name to be passed to spectrogram labels.
Also check that all spectrograms draw individually.
  • Loading branch information
towsey committed Dec 14, 2019
1 parent 664597a commit b1ba0c8
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 91 deletions.
1 change: 0 additions & 1 deletion src/AnalysisConfigFiles/Towsey.Sonogram.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ FrameStep: 441
Waveform: true
DecibelSpectrogram: true
DecibelSpectrogram_NoiseReduced: true
DecibelSpectrogram_Ridges: true
CepstralSpectrogram: true
DifferenceSpectrogram: true
AmplitudeSpectrogram_LocalContrastNormalization: true
Expand Down
13 changes: 6 additions & 7 deletions src/AnalysisConfigFiles/Towsey.SpectrogramGenerator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ FrameLength: 512
# Following frame step yields 50 frames/s which can make some subsequent operations a bit easier.
FrameStep: 441

Waveform: true
DecibelSpectrogram: true
DecibelSpectrogram_NoiseReduced: true
DecibelSpectrogram_Ridges: true
CepstralSpectrogram: true
DifferenceSpectrogram: true
Waveform: false
DecibelSpectrogram: false
DecibelSpectrogram_NoiseReduced: false
CepstralSpectrogram: false
DifferenceSpectrogram: false
AmplitudeSpectrogram_LocalContrastNormalization: true
Experimental: true
Experimental: false

#NOISE REDUCTION PARAMETERS
DoNoiseReduction: true
Expand Down
3 changes: 2 additions & 1 deletion src/AnalysisPrograms/Audio2InputForConvCNN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ public AnalysisResult2 Analyze<T>(AnalysisSettings analysisSettings, SegmentSett
{
var audioFile = segmentSettings.SegmentAudioFile;
var recording = new AudioRecording(audioFile.FullName);
var sourceRecordingName = recording.BaseName;
var outputDirectory = segmentSettings.SegmentOutputDirectory;
bool saveCsv = analysisSettings.AnalysisDataSaveBehavior;
var analysisResult = new AnalysisResult2(analysisSettings, segmentSettings, recording.Duration);
Expand All @@ -805,7 +806,7 @@ public AnalysisResult2 Analyze<T>(AnalysisSettings analysisSettings, SegmentSett
//configurationDictionary[ConfigKeys.Recording.Key_RecordingFileName] = audioFile.Name;
//var soxImage = new FileInfo(Path.Combine(segmentSettings.SegmentOutputDirectory.FullName, audioFile.Name + ".SOX.png"));
var configInfo = ConfigFile.Deserialize<AnalyzerConfig>(analysisSettings.ConfigFile);
var spectrogramResult = Audio2Sonogram.GenerateSpectrogramImages(audioFile, configInfo);
var spectrogramResult = Audio2Sonogram.GenerateSpectrogramImages(audioFile, configInfo, sourceRecordingName);

// this analysis produces no results! But we still print images (that is the point)
if (analysisSettings.AnalysisImageSaveBehavior.ShouldSave(analysisResult.Events.Length))
Expand Down
Loading

0 comments on commit b1ba0c8

Please sign in to comment.