Quantcast

[Csnd] variable rate table writing

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Csnd] variable rate table writing

kghongaku
hey csound friends.

   i've been. trying to write a rate audio to tables at varing speeds.
i've been using tabw and phasor, but i'm noticing that when i write at
speeds < 1, the end of the previous block gets written over by the next
write. is there a way (or an opcode)  to scale the block of audio in
anticipation of the next write being somewhere in the middle of the
current. conversely, is there a table writing opcode that can stretch a
block of audio and write it across multiple blocks if i were to want to
write at speeds greater than 1?

k.

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] variable rate table writing

Oeyvind Brandtsegg-3
Hi Kelly,
It sounds as if you need to make an intermediate buffer for the audio, then you can do those things easily.
The audio block of an a-rate signal "as is" will always be ksmps worth of audio samples, so it is hard to do read/write speed modifications directly with it. If you write it to an array or table, ksmps samples at each k-pass, then you have a buffer you can read from at any speed. You can for example iterate over all samples in a 10-second buffer all within one k-pass, or read them slowly one by one. If it is a continuous process, you could make the intermediate buffer circular, so that it will always contain the most recent N seconds of audio.

2017-05-13 10:02 GMT-07:00 Kelly Hirai <[hidden email]>:
hey csound friends.

   i've been. trying to write a rate audio to tables at varing speeds.
i've been using tabw and phasor, but i'm noticing that when i write at
speeds < 1, the end of the previous block gets written over by the next
write. is there a way (or an opcode)  to scale the block of audio in
anticipation of the next write being somewhere in the middle of the
current. conversely, is there a table writing opcode that can stretch a
block of audio and write it across multiple blocks if i were to want to
write at speeds greater than 1?

k.

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here



--
Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] variable rate table writing

kghongaku
In reply to this post by kghongaku
so, i'm taking a shot at writing an opcode to scale a-blocks under the
direction of the /doc/csound_writing_opcodes.tex in the source tree. i
initially tried to clone the dam opcode and build it into the source
tree. when that failed, i tried to build a local .so file per the
instructions in the document. i've put the local build test case on github.

https://github.com/khirai/ablkscale/

the opcode code compiles fine. i can't seem to get csound to find my
opcode though. this has been the same issue whether i build in the tree
or out.

> make
csound --opcode-lib=./ablkscale.so phasor_debug.orc phasor_debug.sco
virtual_keyboard real time MIDI plugin for Csound
0dBFS level = 32768.0
--Csound version 6.09 (double samples) May 28 2017
[commit: 7827ba33f39a72ad57758685440b4d18c291a57d]
libsndfile-1.0.28
orchname:  phasor_debug.orc
Loading command-line libraries:
rtaudio: ALSA module enabled
rtmidi: ALSA Raw MIDI module enabled

error: syntax error, unexpected T_IDENT  (token "ablkscale") from file
phasor_debug.orc (1)
 line 14:
>>>asigscale  ablkscale <<<
Unexpected untyped word asigscale when expecting a variable
Parsing failed due to invalid input!
Stopping on parser failure.



On 05/13/2017 01:02 PM, Kelly Hirai wrote:

> hey csound friends.
>
>    i've been. trying to write a rate audio to tables at varing speeds.
> i've been using tabw and phasor, but i'm noticing that when i write at
> speeds < 1, the end of the previous block gets written over by the next
> write. is there a way (or an opcode)  to scale the block of audio in
> anticipation of the next write being somewhere in the middle of the
> current. conversely, is there a table writing opcode that can stretch a
> block of audio and write it across multiple blocks if i were to want to
> write at speeds greater than 1?
>
> k.
>

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] variable rate table writing

jpff
Are tee unresolved efeeces in you code?  Or missig interface functions?

Ty runig wit  -v ad/o under gdb ad break in load_module

Or show us your ode


On Sun, 28 May 2017, Kelly Hirai wrote:

> so, i'm taking a shot at writing an opcode to scale a-blocks under the
> direction of the /doc/csound_writing_opcodes.tex in the source tree. i
> initially tried to clone the dam opcode and build it into the source
> tree. when that failed, i tried to build a local .so file per the
> instructions in the document. i've put the local build test case on github.
>
> https://github.com/khirai/ablkscale/
>
> the opcode code compiles fine. i can't seem to get csound to find my
> opcode though. this has been the same issue whether i build in the tree
> or out.
>
>> make
> csound --opcode-lib=./ablkscale.so phasor_debug.orc phasor_debug.sco
> virtual_keyboard real time MIDI plugin for Csound
> 0dBFS level = 32768.0
> --Csound version 6.09 (double samples) May 28 2017
> [commit: 7827ba33f39a72ad57758685440b4d18c291a57d]
> libsndfile-1.0.28
> orchname:  phasor_debug.orc
> Loading command-line libraries:
> rtaudio: ALSA module enabled
> rtmidi: ALSA Raw MIDI module enabled
>
> error: syntax error, unexpected T_IDENT  (token "ablkscale") from file
> phasor_debug.orc (1)
> line 14:
>>>> asigscale  ablkscale <<<
> Unexpected untyped word asigscale when expecting a variable
> Parsing failed due to invalid input!
> Stopping on parser failure.
>
>
>
> On 05/13/2017 01:02 PM, Kelly Hirai wrote:
>> hey csound friends.
>>
>>    i've been. trying to write a rate audio to tables at varing speeds.
>> i've been using tabw and phasor, but i'm noticing that when i write at
>> speeds < 1, the end of the previous block gets written over by the next
>> write. is there a way (or an opcode)  to scale the block of audio in
>> anticipation of the next write being somewhere in the middle of the
>> current. conversely, is there a table writing opcode that can stretch a
>> block of audio and write it across multiple blocks if i were to want to
>> write at speeds greater than 1?
>>
>> k.
>>
>
> Csound mailing list
> [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Loading...