Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slicer outputs without an intermediary file #12

Open
jamesb93 opened this issue Jun 15, 2021 · 1 comment
Open

slicer outputs without an intermediary file #12

jamesb93 opened this issue Jun 15, 2021 · 1 comment

Comments

@jamesb93
Copy link
Member

Hello,

I thought that it might be useful if the CLI had a way of passing its output directly to stdout, rather than into an intermediate file. That way it could be used directly on the command line without having to use a file which then has to be cleaned up, and also would make embedding it in other applications easier.

For example:

If you still wanted an intermediary file:

fluid-noveltyslice -source file.wav -indices stdout >> myslices

but you could also unlock some cool inline scripting like grabbing the first six slices only

fluid-noveltyslice -source file.wav -indices stdout | xargs echo | cut -c 1-6

Again, available to PR this sort of thing if its within scope and if I had some direction :)

@jamesb93
Copy link
Member Author

jamesb93 commented Jun 15, 2021

Just had a quick dig in the code, and added another condition in the control flow of the the write() method:

else if (mPath == "stdout")
{
  FluidTensorView<const float, 2> view{mData.data(), 0, numChans(),
                                  numFrames()};
  std::cout << view.transpose();
}

This seems (at least to my naive view) a pretty decent output and will always be in line with what one would expect from the CSV too. I get comma separated values in the output which I can then pipe around.

I don't mind passing stdout to -indices, actually it makes sense in a way to have lots of different things you can pass to this flag, maybe .JSON in the future :) but the only issue is other things are emitted into stdout also, like the percentage. This could be solved with something like what is proposed in #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant