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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do timestamps work? #6

Open
thbar opened this issue Dec 10, 2016 · 3 comments
Open

How do timestamps work? #6

thbar opened this issue Dec 10, 2016 · 3 comments

Comments

@thbar
Copy link
Collaborator

thbar commented Dec 10, 2016

First thanks for ex-portmidi, I'm starting to use it to play around with my synth & Elixir. I successfully managed to record sequences of events while playing the synth, which is already great 馃槃

If I call PortMidi.write with a timestamp, it seems like the note is played right away, is it expected?

Here is a concrete example:

PortMidi.write(output, [
  {{144, 36, 55}, 13771},
  {{128, 36, 68}, 13919},
  {{144, 48, 64}, 14310},
  {{128, 48, 75}, 14453},
])

(in that case the 2 notes will stack up immediately).

I looked a bit inside the code and in the portmidi documentation, and read here:

timestamps are ignored if the stream was opened with latency = 0

This makes me wonder how timestamps work when called from ex-portmidi.

Did you manage to get them working on your side?

Thanks!

@lucidstack
Copy link
Owner

Hey there, thank you for trying out ex-portmidi, glad it's working (mostly!) for you 馃榾

Good catch there, I had totally missed that bit from the documentation, and just put latency at 0 by default when opening an output device. I'm now adding the option to set your own latency on open.

Will let you know when you can upgrade! 馃憣

@lucidstack
Copy link
Owner

lucidstack commented Dec 15, 2016

@thbar done! 馃帀

Feel free to pull the new version 5.1.0 from Hex. I have added a third optional argument to PortMidi.open/2,3 for latency, defaulting to 0. I've given it a try, and it seems to work okay! Check out the updated documentation if you need to.

Let me know how it goes! 馃憢

PS: I've mentioned you in the changelog for spotting the issue, I hope you don't mind! 馃榾

@thbar
Copy link
Collaborator Author

thbar commented Dec 15, 2016

Thanks a bunch @lucidstack! I'll test this out and will report back & close here.

Happy to be in the changelog, no problem. Thanks again!

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

2 participants