Loop Machine Testing

Post Reply
rchanrussell
F1 - Bilberry
Posts: 1
Joined: Wed Oct 18, 2017 6:51 am

Loop Machine Testing

Post by rchanrussell » Wed Oct 18, 2017 7:05 am

Hello,
As a personal development project, I wrote my own audio looper in C. I based it on simple_client.c from JackAudio.

I've patched my kernel, built jack etc... I've experimented with settings for Jackd...

My question for giada (or any looper sw developer):
When you test, did you use an external metronome or drum machine and do your best to stay in time? Did you find any variable delay?

I have a thread for reading commands from the UART and it sets a boolean for the main thread (which Jack calls when -p X samples are ready). The problem is the time for X samples isn't as accurate as I would have liked. Without having a consistent timing means of copying the data from Jack's buffers, you're introducing another variable delay.

There's a delay from when the user hits "record" and Jack's callback is called, this obviously can vary greatly. There's the same delay with "play" when you stop recording.

I have not worked with any looping software other than GarageBand (nor LoopStation pedals) and I have always used the built-in metronome. So I don't know how well in sync audio looping SW is compared to an external metronome/drum machine.

I am trying to figure out a reliable means to sync so I can manage delays. Variable delays isn't cool!

If it helps here are the details of the design, code, and delays I see (without trying some sort of delay-sync management -- which is what I hope to find some ideas on how to solve here!!).
My design details are here: https://rschanrussell.wordpress.com/pro ... er-design/

GitHub: https://github.com/rchanrussell/rpi_audio_looper_c

Here are the delays (UART processing is on a separate thread, TIMER_PLAY_RECORD_DELAY is the time spent copying data, updating indices, updating states):

/****
* Raspberry Pi 2 B+
****/
// -n 3 -p 128
Timers
Timer TIMER_RECORD_START_DELAY
Max 2476030 ns
Last 10 entries
2476030 ns
669855 ns
1910812 ns
1403096 ns
2126389 ns
595062 ns
0 ns
0 ns
0 ns
0 ns

Timer TIMER_PLAY_RECORD_DELAY
Max 118596 ns
Last 10 entries
118127 ns
117762 ns
117658 ns
117763 ns
117398 ns
117814 ns
117502 ns
117762 ns
117606 ns
128439 ns

Timer TIMER_PROCESS_TO_PROCESS_TIME
Max 3084426 ns
Last 10 entries
3009842 ns
2989112 ns
2998070 ns
2989060 ns
3004998 ns
2997602 ns
2890361 ns
2989685 ns
3084426 ns
2087743 ns

Timer TIMER_RECORD_STOP_DELAY
Max 2873225 ns
Last 10 entries
2873225 ns
1737685 ns
2183578 ns
0 ns
0 ns
0 ns
0 ns
0 ns
0 ns
0 ns

Timer TIMER_UART_PROCESS
Max 110626 ns
Last 10 entries
37501 ns
59012 ns
47605 ns
47761 ns
39584 ns
49012 ns
110626 ns
43647 ns
78439 ns
35991 ns


/*
***********************************
*/

// -n 3 -p 64
Timers
Timer TIMER_RECORD_START_DELAY
Max 2183890 ns
Last 10 entries
2183890 ns
944286 ns
1505077 ns
0 ns
0 ns
0 ns
0 ns
0 ns
0 ns
0 ns

Timer TIMER_PLAY_RECORD_DELAY
Max 67345 ns
Last 10 entries
61876 ns
67345 ns
61823 ns
61876 ns
61980 ns
61928 ns
61771 ns
61720 ns
61824 ns
62032 ns

Timer TIMER_PROCESS_TO_PROCESS_TIME
Max 2042013 ns
Last 10 entries
2042013 ns
1042465 ns
1996595 ns
1002621 ns
991527 ns
1999356 ns
1006111 ns
1991283 ns
994860 ns
1998679 ns

Timer TIMER_RECORD_STOP_DELAY
Max 1716695 ns
Last 10 entries
1716695 ns
846212 ns
0 ns
0 ns
0 ns
0 ns
0 ns
0 ns
0 ns
0 ns

Timer TIMER_UART_PROCESS
Max 123700 ns
Last 10 entries
70053 ns
60730 ns
60470 ns
59533 ns
59637 ns
123700 ns
0 ns
0 ns
0 ns
0 ns



/****
* Raspberry Pi 1.2 B+
****/
// -n 3 -p 128
Timers
Timer TIMER_RECORD_START_DELAY
Max 2644974 ns
Last 10 entries
1344986 ns
1708983 ns
2644974 ns
1475985 ns
1948981 ns
2522978 ns
0 ns
0 ns
0 ns
0 ns

Timer TIMER_PLAY_RECORD_DELAY
Max 183999 ns
Last 10 entries
182998 ns
183999 ns
182999 ns
182998 ns
180998 ns
182998 ns
182998 ns
181998 ns
182998 ns
181998 ns

Timer TIMER_PROCESS_TO_PROCESS_TIME
Max 3076973 ns
Last 10 entries
1986982 ns
2932974 ns
3005974 ns
2974974 ns
3013974 ns
2975974 ns
3001974 ns
3002974 ns
2974974 ns
2993974 ns

Timer TIMER_RECORD_STOP_DELAY
Max 2495975 ns
Last 10 entries
978990 ns
1293987 ns
2495975 ns
1813984 ns
0 ns
0 ns
0 ns
0 ns
0 ns
0 ns

Timer TIMER_UART_PROCESS
Max 138999 ns
Last 10 entries
58000 ns
58999 ns
58999 ns
110999 ns
58000 ns
111999 ns
61999 ns
60000 ns
138999 ns
60999 ns

/*
***********************************
*/

// -n 3 -p 64
Timers
Timer TIMER_RECORD_START_DELAY
Max 2629975 ns
Last 10 entries
1208989 ns
1721983 ns
1482985 ns
2629975 ns
0 ns
0 ns
0 ns
0 ns
0 ns
0 ns

Timer TIMER_PLAY_RECORD_DELAY
Max 148999 ns
Last 10 entries
111999 ns
111999 ns
112999 ns
112999 ns
148999 ns
112999 ns
112999 ns
112999 ns
117998 ns
111999 ns

Timer TIMER_PROCESS_TO_PROCESS_TIME
Max 1984981 ns
Last 10 entries
983990 ns
1982981 ns
1044990 ns
1957981 ns
1014990 ns
1981981 ns
1040990 ns
1984981 ns
1013990 ns
1980981 ns

Timer TIMER_RECORD_STOP_DELAY
Max 1672983 ns
Last 10 entries
1672983 ns
675993 ns
1609985 ns
0 ns
0 ns
0 ns
0 ns
0 ns
0 ns
0 ns

Timer TIMER_UART_PROCESS
Max 1866982 ns
Last 10 entries
83999 ns
59000 ns
174998 ns
1866982 ns
63999 ns
61000 ns
165998 ns
61000 ns
157999 ns
0 ns

Post Reply