[Csnd] Reading sample of arbitrary length from table
Date | 2010-11-09 21:51 |
From | peiman khosravi |
Subject | [Csnd] Reading sample of arbitrary length from table |
Hello, This is probably a very stupid question. I always use Diskin2 so I am not that familiar with reading samples from a table. What is the best way to read an entire sound file of an arbitrary length into a table (i.e. defer table size) and play it back without looping (preferably with high precision)? Of course I know how to read power-of-2+1 tables but that is not very convenient. Or maybe there is a way to automatically set the table size to the nearest power-of-2? I'm just doing some experiments with Cmask and would like to give this a shot for multichannel granular synthesis. Hopefully with grain-by-grain FFT processing. Also, is there a way to load in markers from the sound file into a table and then play from Nth marker to Nth marker (e.g. transient markers generated elsewhere)? I guess the answer is probably a UDO? Thanks in advance Best, Peiman |
Date | 2010-11-09 21:59 |
From | Jacob Joaquin |
Subject | [Csnd] Re: Reading sample of arbitrary length from table |
Peiman, Sorry to be brief, but I'm wicked busy these days. Check out this Csound Blog entry for determining table size to the nearest power of 2+1: http://csoundblog.com/2010/10/beat-mangler-x/ Here's an excerpt from the code: ; Get sample properties gibit filebit gS_sample ; Bit rate gichnls filenchnls gS_sample ; Number of channels gilength filelen gS_sample ; Length in seconds ioffset = gilength * ioffset ; Offset of sample gilength = gilength * isize ; Adjust length to user ; specified size gisr filesr gS_sample ; Sample rate gisize = 2 ^ ceil(logbtwo(gilength * gisr)) ; Table size gilength_s = gilength * gisr ; Length in samples The second line from the bottom determines the table size. Best, Jake -- The Csound Blog - http://csoundblog.com/ Slipmat - http://slipmat.noisepages.com/ On Tue, Nov 9, 2010 at 1:51 PM, peiman khosravi |
Date | 2010-11-09 22:23 |
From | peiman khosravi |
Subject | [Csnd] Re: Re: Reading sample of arbitrary length from table |
Thanks very much Jake. That's awesome! Best, Peiman On 9 November 2010 21:59, Jacob Joaquin <jacobjoaquin@gmail.com> wrote: Peiman, |
Date | 2010-11-09 23:18 |
From | luis jure |
Subject | [Csnd] Re: Reading sample of arbitrary length from table |
on 2010-11-09 at 21:51 peiman khosravi wrote: > Or maybe there is a way to automatically set the table size to the > nearest power-of-2? that's what the operator @ is for. just put [@xxx] as the table size (xxx being the size in samples of your sound file). BTW, i couldn't find it doing a quick search in the manual. is this just folkloric knowledge? or is it documented in some non-obvious place? 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" |
Date | 2010-11-10 00:34 |
From | Rory Walsh |
Subject | [Csnd] Re: Re: Reading sample of arbitrary length from table |
Why do you need to bother with power of two tables sizes? Perhaps I misunderstood the original post... On 9 November 2010 23:18, luis jure |
Date | 2010-11-10 09:23 |
From | peiman khosravi |
Subject | [Csnd] Re: Re: Re: Reading sample of arbitrary length from table |
Only because non of the table-reading opcodes seem to be able to deal with non power of two (+ 1) tables. Or have I missed something? Thanks Peiman On 10 November 2010 00:34, Rory Walsh <rorywalsh@ear.ie> wrote: Why do you need to bother with power of two tables sizes? Perhaps I |
Date | 2010-11-10 09:43 |
From | Andres Cabrera |
Subject | [Csnd] Re: Re: Reading sample of arbitrary length from table |
Hi Luis, Yes! It is arcane folk knowledge that was never documented. I tried o use it once, but since it didn't work for me I didn't document it... Can you provide a simple example so I can add the documentation? Does it work in the score only, or can you use it in the orc as well? Cheers, Andres On Tue, Nov 9, 2010 at 11:18 PM, luis jure |
Date | 2010-11-10 10:25 |
From | Rory Walsh |
Subject | [Csnd] Re: Re: Re: Re: Reading sample of arbitrary length from table |
tab supports non power of two tables size: http://www.csounds.com/manual/html/tab.html Rory. On 10 November 2010 09:23, peiman khosravi |
Date | 2010-11-10 11:17 |
From | Victor Lazzarini |
Subject | [Csnd] Re: Re: Re: Re: Re: Reading sample of arbitrary length from table |
poscil & poscil3 also do. Victor On 10 Nov 2010, at 10:25, Rory Walsh wrote: > tab supports non power of two tables size: > > http://www.csounds.com/manual/html/tab.html > > Rory. > > > > On 10 November 2010 09:23, peiman khosravi > |
Date | 2010-11-10 11:32 |
From | peiman khosravi |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Reading sample of arbitrary length from table |
Thanks Victor but aren't poscil and poscil3 loop-based opcodes only? I wanted something without looping or the ability to turn it off. Best, Peiman On 10 November 2010 11:17, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: poscil & poscil3 also do. |
Date | 2010-11-10 11:42 |
From | Victor Lazzarini |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Re: Reading sample of arbitrary length from table |
Then linseg & tab is the easiest way. On 10 Nov 2010, at 11:32, peiman khosravi wrote: Thanks Victor but aren't poscil and poscil3 loop-based opcodes only? I wanted something without looping or the ability to turn it off. |
Date | 2010-11-10 11:43 |
From | peiman khosravi |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Reading sample of arbitrary length from table |
Great thanks. And how do these compare in terms of osund quality? (they are not high precision I guess?) Thanks Peiman On 10 November 2010 11:42, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
|
Date | 2010-11-10 11:49 |
From | luis jure |
Subject | [Csnd] Re: Re: Re: Reading sample of arbitrary length from table |
on 2010-11-10 at 09:43 Andres Cabrera wrote: >Yes! It is arcane folk knowledge that was never documented. I tried o >use it once, but since it didn't work for me I didn't document it... >Can you provide a simple example so I can add the documentation? >Does it work in the score only, or can you use it in the orc as well? well, i knew it was in the manual somewhere! it's under The Standard Numeric Score -> Evaluation of Expressions: http://csounds.com/manual/html/ScoreEval.html i forgot that there's also @@, that evaluates to the next power-of-2+1. as far as i know, these expressions work only in the score, and therefore need square brackets [ ]. i used them only in f statements, and they certainly worked. there isn't much to put in an example, just that [ @ 11 ] will evaluate to 16, and [ @@ 11 ] to 17. at least two lines like these should be added in the examples in the ScoreEval page, though. cheers, lj 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" |
Date | 2010-11-10 11:57 |
From | Victor Lazzarini |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Reading sample of arbitrary length from table |
Tab interpolates (I think). If you want to use cubic interpolation, the you can always use poscil3 and cutout the audio before wrap-around. ktime timeinsts if ktime < isndur then a1 poscil3 1, kpitch*flen(itab)/sr, itab else a1 = 0 endif or something like that Victor On 10 Nov 2010, at 11:43, peiman khosravi wrote: Great thanks. And how do these compare in terms of osund quality? (they are not high precision I guess?) |
Date | 2010-11-10 15:43 |
From | peiman khosravi |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Reading sample of arbitrary length from table |
Great, thanks. This seems like a good way to go about it. Best, Peiman On 10 November 2010 11:57, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
|
Date | 2010-11-26 09:43 |
From | Andres Cabrera |
Subject | [Csnd] Re: Re: Re: Re: Reading sample of arbitrary length from table |
Thanks, I've added a small note, but with a title to make it more prominent. Cheers, Andres On Wed, Nov 10, 2010 at 11:49 AM, luis jure |
Date | 2010-11-26 13:17 |
From | francesco |
Subject | [Csnd] Re: Reading sample of arbitrary length from table |
Hi all, just a small request: is it @@ macro working right for You? Because i get same result of single @, i.e. always power of 2 and not power of 2 + 1. (i am on ubuntu, csound 5.12). thank You, ciao, francesco. |
Date | 2010-11-26 13:33 |
From | francesco |
Subject | [Csnd] Re: Reading sample of arbitrary length from table |
Ok, apologies, i'm wrong again! It's working. ciao, francesco. |