Csound Csound-dev Csound-tekno Search About

Re: [Csnd] Multi-rate Proof of Concept Code

Date2011-05-06 11:02
Fromkelly hirai
SubjectRe: [Csnd] Multi-rate Proof of Concept Code
i've been able to downsample k-rates with structures like

gktime init 0

instr 1

   if ktime % imyksamps != 0 kgoto SKIP_DOWNSMP
     
   SKIP_DOWNSMP:

endin

gktime=gktime+1

i used this to poll wiimotes at a slower rate than the k-rate i was using 
to control audio parameters.

k.

On Sat, 7 May 2011, Steven Yi wrote:

> Hi All,
>
> At the Linux Audio Conference, I've heard multi-rate control signals
> come up a few times and it seemed to me that it should be possible to
> do something like that in UDO code.  I don't know about efficiency at
> all, but it seems at least possible. :)  I wrote the following as a
> proof of concept that updates a value every 1000 samples.  One can
> modifying the iratesize and will see different values on how fast that
> kvalue is updated.
>
> This proof of concept code shows processing at a rate slower than the
> ksmps of the project, though one can do so faster than ksmps (i.e. use
> iratesize < ksmps), in terms of processing in the project, the last
> value set will be the one used for the processing of the entire
> instrument's run for that ksmps.
>
> If one wanted to do multi-rate audio-signal processing, say for 16x
> oversampling, one could take a similar approach by:
>
> 1. create an ftable that is 16 * ksmps
> 2. taking an asig and reading the values into the ftable via the vaget opcode
> 3. process the ftable with a loop
> 4. downsample manually and write back into an asig using vaset opcode
>
> (if anyone is interested, I can probably go about writing an example)
>
> Thanks!
> steven
>
> 
>
> 
> sr=44100
> ksmps=1
> nchnls=2
>
>
>        instr 1
>
> kndx init 0
> kmrndx init 0
> irateSize = 1000
> kval init 0
>
>
> loopStart:
>
>
> if (kndx == ksmps) goto loopEnd
>
> kndx = kndx + 1
> kmrndx = kmrndx + 1
>
> if (kmrndx == irateSize) then
>
> 	kmrndx = 0
>
> ; DO update to k-value
> kval = kval + 1
>
> 	kgoto 	loopStart
>
> endif
>
> kgoto loopStart
>
> loopEnd:
>
> kndx = 0
>
> printks "MultiRate: %f\n", .1, kval
>
> endin
>
>
> 
>
> 
>
> i1 0 1
>
> e
>
> 
>
> 
>
>
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-05-07 12:38
FromSteven Yi
Subject[Csnd] Multi-rate Proof of Concept Code
Hi All,

At the Linux Audio Conference, I've heard multi-rate control signals
come up a few times and it seemed to me that it should be possible to
do something like that in UDO code.  I don't know about efficiency at
all, but it seems at least possible. :)  I wrote the following as a
proof of concept that updates a value every 1000 samples.  One can
modifying the iratesize and will see different values on how fast that
kvalue is updated.

This proof of concept code shows processing at a rate slower than the
ksmps of the project, though one can do so faster than ksmps (i.e. use
iratesize < ksmps), in terms of processing in the project, the last
value set will be the one used for the processing of the entire
instrument's run for that ksmps.

If one wanted to do multi-rate audio-signal processing, say for 16x
oversampling, one could take a similar approach by:

1. create an ftable that is 16 * ksmps
2. taking an asig and reading the values into the ftable via the vaget opcode
3. process the ftable with a loop
4. downsample manually and write back into an asig using vaset opcode

(if anyone is interested, I can probably go about writing an example)

Thanks!
steven




sr=44100
ksmps=1
nchnls=2


        instr 1

kndx init 0
kmrndx init 0
irateSize = 1000
kval init 0


loopStart:


if (kndx == ksmps) goto loopEnd

kndx = kndx + 1
kmrndx = kmrndx + 1

if (kmrndx == irateSize) then

	kmrndx = 0

; DO update to k-value
kval = kval + 1

	kgoto 	loopStart

endif

kgoto loopStart

loopEnd:

kndx = 0

printks "MultiRate: %f\n", .1, kval

endin






i1 0 1

e






Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-05-07 22:18
FromJacob Joaquin
SubjectRe: [Csnd] Multi-rate Proof of Concept Code
I've been considering running a series of computer music related
thought experiments / brainstorms. I think this actually a great topic
to start, if anyone wants to join in. The idea is to present a problem
and have a non-formal / theoretical discussion about it. For example:

Describe a situation in which multiple sample-rates would be a great
asset/advantage.

One situation I can think of is for audio synthesis. I believe the
sampling rate of the Yamaha DX7 is 60kHz. If one was to create an
authentic emulator, 60kHz would be necessary to match the aliasing
properties. Without multi-rate support, the entire orchestra would
have to be fixed at 60kHz, which could add significant unneeded
overhead to expensive processes such as granular synthesis and phase
vocoding.

Jake
-- 
The Csound Blog - http://csoundblog.com/
Slipmat - http://slipmat.noisepages.com/




On Sat, May 7, 2011 at 4:38 AM, Steven Yi  wrote:
> Hi All,
>
> At the Linux Audio Conference, I've heard multi-rate control signals
> come up a few times and it seemed to me that it should be possible to
> do something like that in UDO code.  I don't know about efficiency at
> all, but it seems at least possible. :)  I wrote the following as a
> proof of concept that updates a value every 1000 samples.  One can
> modifying the iratesize and will see different values on how fast that
> kvalue is updated.
>
> This proof of concept code shows processing at a rate slower than the
> ksmps of the project, though one can do so faster than ksmps (i.e. use
> iratesize < ksmps), in terms of processing in the project, the last
> value set will be the one used for the processing of the entire
> instrument's run for that ksmps.
>
> If one wanted to do multi-rate audio-signal processing, say for 16x
> oversampling, one could take a similar approach by:
>
> 1. create an ftable that is 16 * ksmps
> 2. taking an asig and reading the values into the ftable via the vaget opcode
> 3. process the ftable with a loop
> 4. downsample manually and write back into an asig using vaset opcode
>
> (if anyone is interested, I can probably go about writing an example)
>
> Thanks!
> steven
>
> 
>
> 
> sr=44100
> ksmps=1
> nchnls=2
>
>
>        instr 1
>
> kndx init 0
> kmrndx init 0
> irateSize = 1000
> kval init 0
>
>
> loopStart:
>
>
> if (kndx == ksmps) goto loopEnd
>
> kndx = kndx + 1
> kmrndx = kmrndx + 1
>
> if (kmrndx == irateSize) then
>
>        kmrndx = 0
>
> ; DO update to k-value
> kval = kval + 1
>
>        kgoto   loopStart
>
> endif
>
> kgoto loopStart
>
> loopEnd:
>
> kndx = 0
>
> printks "MultiRate: %f\n", .1, kval
>
> endin
>
>
> 
>
> 
>
> i1 0 1
>
> e
>
> 
>
> 
>
>
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"