Author |
Message |
Frostburn
Joined: Dec 12, 2007 Posts: 255 Location: Finland
Audio files: 9
|
Posted: Mon Jan 14, 2008 10:38 am Post subject:
Hid refresh rate Subject description: what does it depend on? |
|
|
I read about the Theremin and I just had to make a digital FM theremin using two mice.
It seems that the smalles duration between two hid messages is 1024::samp on my machine. Is there any way to make it even more rapid? What decides the refresh rate? ChucK, Linux's kernel, USB or the hid-device in question? _________________ To boldly go where no man has bothered to go before. |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Mon Jan 14, 2008 12:19 pm Post subject:
|
|
|
so, that's 44 or 48 messages per second? that does sound a bit slow to me I don't think you can change this from within ChucK code but it also seems odd that it's linked to the sample rate at such a remarkbable number. I'd ask Spencer as he did the HID implementation.
You could find his private adress easily as he also maintains the Mini but as this is likely of interest to more people you might want to try the users list.
You could of course also dig in the source if you feel adventerous... _________________ Kassen |
|
Back to top
|
|
|
Frostburn
Joined: Dec 12, 2007 Posts: 255 Location: Finland
Audio files: 9
|
Posted: Mon Jan 14, 2008 1:59 pm Post subject:
|
|
|
*Bangs head*
The answer was almost too obvious.
I'm running JACK for easier connection between ChucK and other programs and it has a setting called Frames/Period that was set to 1024. Very strangely changing this to 16 brings the smallest achievable duration between hid events to 16::samp.
Running on my chuck.alsa build without JACK the update duration was 512::samp.
ChucK with --silent did what I believe to be 1::samp.
So the hid refresh rate depends on the system that ticks ChucK. _________________ To boldly go where no man has bothered to go before. |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Mon Jan 14, 2008 7:26 pm Post subject:
|
|
|
Right! And Jack was likely asuming a system that used block-processing and trying to sync all blocks? (ChucK doesn't use block-processing, this is very cool for many things and also somewhat expensive).
Good to know! _________________ Kassen |
|
Back to top
|
|
|
Frostburn
Joined: Dec 12, 2007 Posts: 255 Location: Finland
Audio files: 9
|
Posted: Tue Jan 15, 2008 2:36 am Post subject:
|
|
|
Hmm... When I'm not running jack the refesh rate depends on the --bufsize that I set for chuck.alsa . I wonder if it would be possible not to constrain it at all... let hid run freely. Maybe I'll need to ask Spencer about this. _________________ To boldly go where no man has bothered to go before. |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Tue Jan 15, 2008 7:40 am Post subject:
|
|
|
Yeah, that makes sense, I suppose.
Are you running a realtime kernel? If not installing one will likely bring down the lowest bufsize you can use. Installing one isn't hard anymore, at least not on Debian and it's children (like the popular Ubuntu). I had one on 7.10 after a few seconds download and a reboot. It's worth your efford if you didn't yet. _________________ Kassen |
|
Back to top
|
|
|
Frostburn
Joined: Dec 12, 2007 Posts: 255 Location: Finland
Audio files: 9
|
Posted: Tue Jan 15, 2008 10:56 am Post subject:
|
|
|
[quote="Kassen"]Are you running a realtime kernel? If not installing one will likely bring down the lowest bufsize you can use. Installing one isn't hard anymore, at least not on Debian and it's children (like the popular Ubuntu). I had one on 7.10 after a few seconds download and a reboot. It's worth your efford if you didn't yet.[quote]
I installed a realtime kernel and realtime-lms but I still couldn't get jack to run with the realtime option... Maybe I'm doing something wrong here. _________________ To boldly go where no man has bothered to go before. |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Tue Jan 15, 2008 11:13 am Post subject:
|
|
|
I'm not sure what Jack's realtime option does, might be just what you need, but I was able to get my ALSA buffersize on ChucK way down using one.
I'm going to bring this topic to the atention of my friend Nescivi who's a bit of a expert on HID usage for sound on Linux. _________________ Kassen |
|
Back to top
|
|
|
nescivi
Joined: Mar 23, 2005 Posts: 94 Location: Montreal
|
Posted: Tue Jan 15, 2008 12:24 pm Post subject:
|
|
|
Well, HID rate is as fast as the USB transport goes, and then what the software does with it. So it should not by definition depend on the buffer size of the audio interface. I am unfamiliar with how HID is implemented in Chuck, but I strongly suspect the problem lies there. I suspect that underneath it only checks the HID values once each buffer frame, instead of updating it whenever there is a new value. |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Tue Jan 15, 2008 12:52 pm Post subject:
|
|
|
Thanks Marije!
Frost, I'd say it's time to send a friendly mail to Spencer with all the info you have now. _________________ Kassen |
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Wed Jan 16, 2008 11:46 pm Post subject:
|
|
|
Frostburn makes a Theremin with ChucK...
The force is strong with this one!
Kas, have you spoken to Yoda about his training? |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Thu Jan 17, 2008 3:15 am Post subject:
|
|
|
Last time I spoke with Yoda he was claiming to meditate but there was a huge pile of bottles in the corner so I thought it best not to disturb him, I think Frostburn has been consulting Finnish Moutain trolls instead!
_________________ Kassen |
|
Back to top
|
|
|
Frostburn
Joined: Dec 12, 2007 Posts: 255 Location: Finland
Audio files: 9
|
Posted: Sat Jan 19, 2008 3:03 am Post subject:
|
|
|
I mailed with Spencer and I quote, (hopefully he wont mind):
Spencer Salazar wrote: |
I believe that the audio buffer size determines ChucK's overall
refresh rate--all Ugen calculation and user ChucK code execution
occurs on audio buffer boundaries. I think the advantage to this is
that it helps avoid audible dropouts in the signal to the DAC. |
_________________ To boldly go where no man has bothered to go before. |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Sun Jan 20, 2008 12:56 pm Post subject:
|
|
|
Frostburn wrote: | I mailed with Spencer and I quote, (hopefully he wont mind):
Spencer Salazar wrote: |
I believe that the audio buffer size determines ChucK's overall
refresh rate--all Ugen calculation and user ChucK code execution
occurs on audio buffer boundaries. I think the advantage to this is
that it helps avoid audible dropouts in the signal to the DAC. |
|
Ow. That kinda makes sense but it does make small buffers quite important. _________________ Kassen |
|
Back to top
|
|
|
|