[chuck-users] Get audio samples of adc (fernando alonso)

Perry Cook prc at CS.Princeton.EDU
Fri Jun 7 13:34:48 EDT 2013


//   Quick example of filling an array from the adc

// we must suck samples from adc, blackhole does this (dac would too)
// gain UG is there to make sure adc is disconnected at end of run

adc => Gain input => blackhole; 

4096 => int SIZE;
int myArray[SIZE];

while (true)  {
    for (0 => int i; i < SIZE; i++)  {
    	32768 * input.last() $ int => myArray[i];  // make floats into ints
	1.0 :: samp => now;				// do this each sample
    }
    // do useful things to your array, or spork a function to do that
}


On Jun 7, 2013, at 10:19 AM, chuck-users-request at lists.cs.princeton.edu wrote:

> Send chuck-users mailing list submissions to
> 	chuck-users at lists.cs.princeton.edu
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> or, via email, send a message with subject or body 'help' to
> 	chuck-users-request at lists.cs.princeton.edu
> 
> You can reach the person managing the list at
> 	chuck-users-owner at lists.cs.princeton.edu
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of chuck-users digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: Get audio samples of adc (fernando alonso)
>   2. Re: chuck-users Digest, Vol 95, Issue 4 (Casper Schipper)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 7 Jun 2013 18:05:40 +0200
> From: fernando alonso <lualobus at gmail.com>
> To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> Subject: Re: [chuck-users] Get audio samples of adc
> Message-ID:
> 	<CAJvVncrU+e-NarWUHdYqMLqJB6V9B4Ph-OYNbvo4LUc0LzAV6g at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> Thanks for the fast reply. I have write this code:
> 
> 
> fun int[] discreteHaarWaveletTransform( int input[]){
>    int sum, difference,length,i;
>    int  output[input.cap()];
> 
> 
>    for ( (input.cap() >> 1) => length ; true ;  (length >> 1) => length) {
>        for (0 => i; i < length; ++i) {
>            input[i * 2] + input[i * 2 + 1] => sum;
>            input[i * 2] - input[i * 2 + 1] => difference;
>            sum => output[i] ;
>            difference => output[length + i];
>        }
>        if (length == 1) {
>            return output;
>        }
> 
>        //Swap arrays to do next iteration
>        for (0=>i; i < (length<<1); i++){
>            output[i] => input[i];
>        }
>    }
> }
> 
> 
> 
> 
> For this reason I need the int input [] array relating to adc input
> samples.  I need to extract the "raw" values of the input (without
> FFT). I have test with something like that:
> 
> adc.chan(0) => UGen inputMic;
> 
> 
> Thanks for the help!
> 
> 
> 
> 
> 
> 2013/6/7 Aur?lien Bondis <abondis at kerunix.com>:
>> Hi,
>> I don't know what a wavelet transform is, but can't 'adc =>' work ? or
>> 'LiSa' do what you need?
>> (http://chuck.cs.princeton.edu/doc/program/ugen_full.html#LiSa)
>> Sorry if I did not understand the question...
>> Aur?lien.
>> 
>> On Fri, 07 Jun 2013, fernando alonso wrote:
>> 
>>> Hi,
>>> 
>>> I want to program de Wavelet Transform, and for it I need to get the
>>> audio samples. Do you know some way to get the audio samples?
>>> 
>>> 
>>> Thanks.
>>> 
>>> --
>>> Fernando Alonso Mart?n
>>> Lualobus at gmail.com
>>> http://roboticnaturalinteraction.com
>>> _______________________________________________
>>> chuck-users mailing list
>>> chuck-users at lists.cs.princeton.edu
>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> 
> 
> 
> -- 
> Fernando Alonso Mart?n
> Lualobus at gmail.com
> http://roboticnaturalinteraction.com
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Fri, 7 Jun 2013 19:19:22 +0200
> From: Casper Schipper <casper.schipper at gmail.com>
> To: chuck-users at lists.cs.princeton.edu
> Subject: Re: [chuck-users] chuck-users Digest, Vol 95, Issue 4
> Message-ID:
> 	<CAHRsh5zJKrPpX93WJixA_qORJkxviHidju=_RWXEJdEJxCx-Kw at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hey,
> 
> You can collect the values from the ADC by calling it's .last() method.
> 
> so for example:
> 
> float values[32];
> int i;
> 
> for (int i;i<values.size;i++) {
> adc.last() => values[i];
> samp => now;
> }
> 
> I think what is confusing you is that chuck ugens works sample by sample
> and not by sending a vector like other languages.
> 
> Does this help ?
> 
> Happy chucking,
> Casper
> 
> 
> 
> On Fri, Jun 7, 2013 at 7:19 PM, Casper Schipper
> <casper.schipper at gmail.com>wrote:
> 
>> 
>> Hey,
>> 
>> You can collect the values from the ADC by calling it's .last() method.
>> 
>> so for example:
>> 
>> float values[32];
>> int i;
>> 
>> for (int i;i<values.size;i++) {
>> adc.last() => values[i];
>> samp => now;
>> }
>> 
>> I think what is confusing you is that chuck ugens works sample by sample
>> and not by sending a vector like other languages.
>> 
>> Does this help ?
>> 
>> Happy chucking,
>> Casper
>> 
>> 
>> 
>> Thanks for the fast reply. I have write this code:
>> 
>> 
>> fun int[] discreteHaarWaveletTransform( int input[]){
>>    int sum, difference,length,i;
>>    int  output[input.cap()];
>> 
>> 
>>    for ( (input.cap() >> 1) => length ; true ;  (length >> 1) => length) {
>>        for (0 => i; i < length; ++i) {
>>            input[i * 2] + input[i * 2 + 1] => sum;
>>            input[i * 2] - input[i * 2 + 1] => difference;
>>            sum => output[i] ;
>>            difference => output[length + i];
>>        }
>>        if (length == 1) {
>>            return output;
>>        }
>> 
>>        //Swap arrays to do next iteration
>>        for (0=>i; i < (length<<1); i++){
>>            output[i] => input[i];
>>        }
>>    }
>> }
>> 
>> 
>> 
>> 
>> For this reason I need the int input [] array relating to adc input
>> samples.  I need to extract the "raw" values of the input (without
>> FFT). I have test with something like that:
>> 
>> adc.chan(0) => UGen inputMic;
>> 
>> 
>> Thanks for the help!
>> 
>> 
>> 
>> Casper Schipper
>> casper.schipper at gmail.com
>> www.casperschipper.nl
>> +316 52322590
>> 
>> On 7 jun. 2013, at 18:00, chuck-users-request at lists.cs.princeton.eduwrote:
>> 
>> Send chuck-users mailing list submissions to
>> chuck-users at lists.cs.princeton.edu
>> 
>> To subscribe or unsubscribe via the World Wide Web, visit
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>> or, via email, send a message with subject or body 'help' to
>> chuck-users-request at lists.cs.princeton.edu
>> 
>> You can reach the person managing the list at
>> chuck-users-owner at lists.cs.princeton.edu
>> 
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of chuck-users digest..."
>> Today's Topics:
>> 
>>  1. Re: Get audio samples of adc (Aur?lien Bondis)
>>  2. Re: EspGrid 0.42 (Michael Heuer)
>> 
>> *From: *Aur?lien Bondis <abondis at kerunix.com>
>> *Subject: **Re: [chuck-users] Get audio samples of adc*
>> *Date: *7 juni 2013 17:48:51 CEST
>> *To: *ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
>> *Reply-To: *ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
>> 
>> 
>> Hi,
>> I don't know what a wavelet transform is, but can't 'adc =>' work ? or
>> 'LiSa' do what you need?
>> (http://chuck.cs.princeton.edu/doc/program/ugen_full.html#LiSa)
>> Sorry if I did not understand the question...
>> Aur?lien.
>> 
>> On Fri, 07 Jun 2013, fernando alonso wrote:
>> 
>> Hi,
>> 
>> I want to program de Wavelet Transform, and for it I need to get the
>> audio samples. Do you know some way to get the audio samples?
>> 
>> 
>> Thanks.
>> 
>> --
>> Fernando Alonso Mart?n
>> Lualobus at gmail.com
>> http://roboticnaturalinteraction.com
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>> 
>> 
>> 
>> 
>> 
>> *From: *Michael Heuer <heuermh at gmail.com>
>> *Subject: **Re: [chuck-users] EspGrid 0.42*
>> *Date: *7 juni 2013 17:56:23 CEST
>> *To: *ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
>> *Reply-To: *ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
>> 
>> 
>> Hello David,
>> 
>> This looks very cool.
>> 
>> The docs mention an esp.ck ChucK file and I see it in the 0.42 .zip
>> file but it is not in the source tree on Google Code.
>> 
>>  michael
>> 
>> 
>> On Thu, Jun 6, 2013 at 12:00 PM, David Ogborn <ogbornd at mcmaster.ca> wrote:
>> 
>> Dear friends,
>> 
>> I am pleased to announce the official release of version 0.42 of the
>> EspGrid
>> software - the synchronization and sharing software for laptop ensembles I
>> have developed around the Cybernetic Orchestra at McMaster, during the
>> project "Scalable, Collective Traditions of Electronic Sound Performance"
>> (supported by Canada's Social Sciences and Humanities Research Council,
>> SSHRC).  The software and some additional helpful files (code/patches) can
>> be downloaded here: http://esp.mcmaster.ca/EspGrid-0.42-OSX-10.7.zip
>> 
>> Over the course of the past year, earlier versions of the software have
>> been
>> presented at the Toronto Electroacoustic Symposium, the Audio Engineering
>> Society Convention in San Francisco, and most recently, the
>> live.code.festival in Karlsruhe, Germany.  This 0.42 release is a "clean-up
>> release" - with better stability and synchronization.  EspGrid has been
>> developed around the ideas of neutrality and hybridity with respect to the
>> languages and environments employed by laptop and live coding performers.
>> The EspGrid application "sits in the background" and takes care of clock
>> synchronization, to a large degree independent of the diverse and multiple
>> "foreground" environments in which performers/creators work.  Another
>> participant in the live.code.festival session (chair Alex McLean, if I
>> recall correctly) provided a perfect example of the intent of the EspGrid
>> software: three electronic musicians find themselves on a train together;
>> despite all using different languages/tools to make their music, they each
>> fire up EspGrid and instantly share a tight common clock and a metronome
>> that anyone can control.  Jamming ensues...
>> 
>> The EspGrid software is being made available to community as free and open
>> source software (GNU public license version 3).  The code base of the
>> software includes a large and growing number of unit tests, and development
>> should proceed according to the principles of test-driven development.  The
>> rudiments of a help/documentation system are in place.  Binary executables
>> exist only for Mac OS X at the present moment but the Windows and Linux
>> ports of the software are the highest, immediate priority following this
>> release.  Windows and Linux users in mixed laptop ensembles don't need to
>> wait for these ports however: there is a "side chain" mechanism that allows
>> users/machines without a running grid to piggyback on a user/machine that
>> is
>> running the grid.
>> 
>> To get/browse the source code, visit the software's Google code site at:
>> http://code.google.com/p/espgrid
>> 
>> Enjoy - and feel free to get in touch for help/issues with the software.  I
>> hope that some of you will find this useful, and look forward to working
>> with you on the (gradual) evolution of this tool!
>> 
>> Yours truly,
>> David
>> 
>> --------------------------------------------------------------------------
>> Dr. David Ogborn, Assistant Professor
>> Communication Studies & Multimedia
>> Director, Cybernetic Orchestra
>> McMaster University, Hamilton, Canada
>> 
>> http://esp.mcmaster.ca
>> http://davidogborn.net
>> http://twitter.com/d0kt0r0
>> 1-905-525-9140 ext 27603
>> 
>> 
>> 
>> 
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>> 
>> 
>> 
>> 
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>> 
>> 
>> 
>> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20130607/874befcc/attachment.htm>
> 
> ------------------------------
> 
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> 
> 
> End of chuck-users Digest, Vol 95, Issue 5
> ******************************************



More information about the chuck-users mailing list