Repository navigation
fix(cli): write one CSV column per value - #1671
Open
draarivpatel-ui wants to merge 1 commit into
Open
draarivpatel-ui wants to merge 1 commit into
draarivpatel-ui wants to merge 1 commit into
Conversation
The CSV writer had two problems: - The header had one name per feature, so multi-value features such as mfcc, amplitudeSpectrum, loudness and complexSpectrum had no labels for their values. - Multi-value features were followed by an extra comma, which left an empty column in every row and shifted the columns after it. Nested values are now flattened recursively for both the header and each row, so names look like mfcc_0, complexSpectrum_real_0 or loudness_total, and every row has one value per column. Fixes meyda#1048
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The CLI's CSV output had two problems that made the file hard to load:
mfccoramplitudeSpectrumhad no column labels.This is the problem described in #1048.
Change
mfcc_0tomfcc_12,amplitudeSpectrum_0,loudness_specific_0,loudness_total,complexSpectrum_real_0,complexSpectrum_imag_0.bin/cli.jschanges. JSON output and console output are unchanged.Before and after
Command:
node bin/cli.js tone.wav mfcc rms amplitudeSpectrum --o=out.csv, using a 0.5 s test tone at 22050 Hz.mfcc,rms,amplitudeSpectrum(3 names). Each row has 272 fields, with an empty field after the 13 mfcc values.Command:
node bin/cli.js tone.wav loudness complexSpectrum --o=out.csvTests:
npx jestpasses 112 of 112.eslintandprettier --checkpass onbin/cli.js.Not in this PR
Running
spectralFluxalone crashes the CLI withdest.destroy is not a function. This also happens on the unmodified code. It is a separate problem and is not changed here.Fixes #1048