metronome | Apache Mesos framework for scheduled jobs | Job Orchestrator library
kandi X-RAY | metronome Summary
kandi X-RAY | metronome Summary
Metronome is an Apache Mesos framework for scheduled jobs.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of metronome
metronome Key Features
metronome Examples and Code Snippets
Community Discussions
Trending Discussions on metronome
QUESTION
I'm building the a metronome with swiftUI
I have a @State var that connect to a slider.
...ANSWER
Answered 2021-May-14 at 06:35The easiest way to perform code when a @State
value changes is to add an onChange
modifier to a child view of the view where you defined your @State
, e.g.:
QUESTION
I want to build a simple metronome app using AVAudioEngine with these features:
- Solid timing (I know, I know, I should be using Audio Units, but I'm still struggling with Core Audio stuff / Obj-C wrappers etc.)
- Two different sounds on the "1" and on beats "2"/"3"/"4" of the bar.
- Some kind of visual feedback (at least a display of the current beat) which needs to be in sync with audio.
So I have created two short click sounds (26ms / 1150 samples @ 16 bit / 44,1 kHz / stereo wav files) and load them into 2 buffers. Their lengths will be set to represent one period.
My UI setup is simple: A button to toggle start / pause and a label to display the current beat (my "counter" variable).
When using scheduleBuffer's loop property the timing is okay, but as I need to have 2 different sounds and a way to sync/update my UI while looping the clicks I cannot use this. I figured out to use the completionHandler instead which the restarts my playClickLoop() function - see my code attach below.
Unfortunately while implementing this I didn't really measure the accuracy of the timing. As it now turns out when setting bpm to 120, it plays the loop at only about 117,5 bpm - quite steadily but still way too slow. When bpm is set to 180, my app plays at about 172,3 bpm.
What's going on here? Is this delay introduced by using the completionHandler? Is there any way to improve the timing? Or is my whole approach wrong?
Thanks in advance! Alex
...ANSWER
Answered 2021-May-02 at 14:50How accurate is the tool or process which you are using to get your measure?
I can't tell for sure that your files have the correct number of PCM frames as I am not a C programmer. It looks like data from the wav header is included when you load the files. This makes me wonder if maybe there is some latency incurred with the playbacks while the header information is processed repeatedly at the start of each play or loop.
I had good luck building a metronome in Java by using a plan of continuously outputting an endless stream derived from reading PCM frames. Timing is achieved by counting PCM frames and routing in either silence (PCM datapoint = 0) or the click's PCM data, based on the period of the chosen metronome setting and the length of the click in PCM frames.
QUESTION
Recently I've been trying to figure out how to write a metronome app, but I've come across many difficulties with OS time control (calling functions e.g.) or significantly inaccurate onset detection algorhithms (I've used librosa) and it seems to be a pretty complicated topic. Yet for some reason I wasn't successfull in my research upon professional metronome apps source code/tutorials/books touching the topic etc... The web seems to be filled with amateur examples and solutions that don't really meet the modern metronome app (such as Frozenapes iOS Tempo app) standards. e.g. a metronome which uses pre-recorded .wav samples when a certain tempo is called (so there are all the tempos between 30 and 300 bpm stored in the app). That kind of solutions seem to be a bit of dead end if user wants to change the tempo while metronome is working. To sum it up - I'm looking for any professional resources with code/text/whatev which isn't 2000 pages signal processing book for math graduates and could help me with designing a decent metronome with some recording features.
...ANSWER
Answered 2021-Apr-18 at 06:56Maybe my experience with writing a metronome using Java will be helpful. The key was not relying on the system clock, but instead, on counting the exact number of PCM frames and placing the click audio PCM at that point. At a sample rate of 44100 fps, that is basically accuracy to 1/44100th of a second.
I cannot advise you as to how to stream PCM and to count the frames as they pass. Does Python even give you access to the individual frames?
QUESTION
I'm trying to write a simple metronome with librosa.clicks
...ANSWER
Answered 2021-Apr-08 at 22:50I have imported the click as wav file into an audio editor and found that it is accurate within 1-2 samples.
Onset detection algorithms are not perfect and very dependant on the transient of the signal.
I have plotted the waveform against the onset_samples and even at a birds-eye view you can tell that the onset times are not that consistent.
bottom line: the click is fine. its the onset detection that is off.
QUESTION
I'm trying to write a python based metronome with librosa and sounddevice but I've came across some problems with it's accuracy. Here's the code:
...ANSWER
Answered 2021-Apr-07 at 21:23Running your code on a mac, the timing inconsistencies are noticeable but also the tempo was of quite a bit off from the set bpm.
This is mostly because sleep()
isn't that accurate, but also because you have to account for the time that has elapsed since the last event. e.g. how much time did it take to call sd.play()
I don't know on what operating system you did run this, but most operating systems have a special timer for precise callbacks (e.g. Multimedia Timers on Windows). if you don't want a platform specific solution to improve the timing you could do a "busy wait" instead on sleep()
. To do this you could sleep for have the delay, and then go into a loop where you constantly check the time elapsed.
QUESTION
I am new to AudioKit and programming music app. I'm building a metronome app and using AudioKit's AKMetronome. I want to have a feature where a user can specify a sequence of beat patterns with different tempo. But I find it is inaccurate to use apple's DispatchQueue.
I'm thinking of rewriting the metronome using AKSequencer. Is there a way to use AudioKit's sequencer to change tempo on the fly or generate a sequence with multiple different tempo? (Sequencer example: https://github.com/AudioKit/Cookbook/blob/main/Cookbook/Cookbook/Recipes/Shaker.swift)
...ANSWER
Answered 2021-Mar-20 at 13:39A possible solution would be to create a tempo track, which would contain tempo events that when processed change the sequencer's tempo.
This is an outline of what should be done:
- Create a track to contain the tempo events, using AKSequencer's addTrack method. Connect this track to an AKCallbackInstrument. Please see this answer on how to connect an AKCallbackInstrument to an AKSequencer track.
- Add the tempo events to the track, at the time positions where there are tempo changes. As far as I know, there are no standard MIDI events for indicating tempo changes (such as a control change for tempo). But as you will be interpreting the events yourself with a callback function, it doesn't really matter what type of event you use. I explain below how to represent the tempo.
- Process the events in the callback function and set AKSequencer's tempo to the indicated tempo.
It’s a little difficult to represent the tempo value inside a MIDI event because usually, MIDI parameters go from 0 to 127. What I would do is use a Note On
event, in the note's pitch I would store tempo div 128
and in the note's velocity, tempo % 128
.
This is what your callback function would look like:
QUESTION
Thanks for AudioKit!
I'm a beginner in Swift and AudioKit, so this may be an easy question:
I want to build a metronome app. From the example in Audiokit's new CookBook and the old AKMetronome(), I can see how to build a simple metronome using AudioKit. But I don't know how to play beats with compound time signatures (3/8, 7/8, etc.). Both examples here use a time signature with 4 as a fixed bottom number and the top number can be changed (i.e. we can have 1/4, 3/4, 6/4 but not 3/8, 6/8).
Is there a way to change the bottom number?
Link for AKMetronome: https://audiokit.io/docs/Classes/AKMetronome.html#/s:8AudioKit11AKMetronomeC5resetyyF
AudioKit Cookbook's Shaker Metronome: https://github.com/AudioKit/Cookbook/blob/main/Cookbook/Cookbook/Recipes/Shaker.swift
...ANSWER
Answered 2021-Mar-04 at 20:32I made some changes to the Shaker Metronome's code to illustrate how you could create a metronome that plays different time signatures such as 6/8, 5/8, 7/8, and so on.
First I added some information to the ShakerMetronomeData
structure:
QUESTION
I'm trying to make a visual metronome of sorts in which I press a button in order to change the bpm. Once the bpm is 85, if the button is pressed once more, if goes back to the default bpm (of 120). t this is my code:
...ANSWER
Answered 2021-Feb-27 at 18:27As mentioned you have to tell python, that you want to use the "bpmButton" variable from outside the function. Because otherwise python instantiates a new variable with the same name, but no value. Try this:
QUESTION
I tried to make a metronome using HTML and JS. I know the audio can't autoplay due to restrictions (I don't want it to anyway), so I placed an element with a
inside, with all (I thought?) appropriate attributes; I controlled playback using JS triggered by a button click. This works on my laptop and even in the XBox Edge browser, but on iOS browsers (both Safari and Firefox) the sound does not play. The HTML looks like this:
ANSWER
Answered 2021-Feb-23 at 10:46I am not sure if this is documented anywhere (I didn't stumble across it), but after some additional testing I discovered that iOS prohibits use of the .play()
function on an existing HTML element or JS
Audio()
element, unless called directly and synchronously as the result of a user UI event. In other words, this will work:
QUESTION
I'm working on a timer that needs to do some calculations and run some functions at a certain interval. I'm trying to keep the interval as big as possible, but I need it to be kind of fine grained.
Here is the periodic timer with some of the stuff that needs to happen. So as you can see, every second (the milliseconds passed % 1000 == 0) it will do some stuff if some conditions are met. But also every 10 milliseconds I need to check some stuff.
It seems this is a bit too much, and after running the timer for 2 minutes it already drags 1 second behind. I guess I'm approaching this the wrong way. Could/should I somehow put all that logic in a function that just runs async so the timer can just keep going.
It's not the end of the world if the timer display drags for a few milliseconds every now and then, if it catches up later. But now the whole timer just drags.
...ANSWER
Answered 2021-Feb-21 at 21:45You cannot rely on a timer to deliver events exactly on time. You need to use a more exact method than simply incrementing a counter by 10 on every tick. One example would be to start a Stopwatch
before the timer and then (knowing that your ticks will only be on approximately 10ms intervals) read stopwatch.elapsedMilliseconds
and base your decisions on that.
You will need to change your logic a bit. For example, you want to know when you pass a 1 second boundary. Previously, with your exact increments of 10 you knew you would eventually reach a round 1000. Now, you might see 995 followed by 1006, and need to deduce that you've crossed a second boundary to run your per second logic.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install metronome
When rolling the deployment of Metronome yourself make sure to align with the dependency on Marathon to match the version noted in the release notes of Metronome. Releases can be downloaded by finding out the version number and short commit hash from the github releases to form the url like. It is assumed that you have a running Mesos and Marathon setup. https://mesosphere.github.io/marathon/docs/ details how to setup Mesos and Marathon. You can start Metronome via systemd after unarchiving the download to e.g. /opt/mesosphere/metronome. Configuration in the case of above systemd file happens via EnfironmentFile at /etc/sysconfig/metronome.
Get familiar with Metronome with this step-by-step Getting Started guide.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page