hi Martin,

On Sun, 28 Jan 2024 13:27:45 -0600
"Martin McCormick" <marti...@suddenlink.net> wrote:

> Several years ago, I wrote some C code which turns one's
> computer's sound interface in to a sound-activated recorder that
> I could then connect to radio receivers or microphones and record
> when audio started and stop recording when there is nothing but
> silence.  One essentially sets a sound card to record
> continuously but the sound samples go through code that knows
> what silence looks like.  In short, silence looks like samples
> whose numeric value is exactly half-way between the lowest and
> highest voltage that the analog-to-digital converter reads,
> commonly either 32,767 representing silence, give or take a count
> or two due to digital sampling errors or decimal 128, hex 80 for
> 8-bit mono audio.
> 
>       The Advanced Linux Sound Architecture Project has C library
> functions for setting sample rates, mono, stereo, big or little
> endianness and 8 or 16-bit audio, whatever one needs for their
> application.  One can even define samples as signed or unsigned
> integers.
> 
>       Once one gets a stream of ints which are usually 32-bits
> wide for stereo or 16-bit shorts for mono, the sound processing
> can begin which C is really good at but perl is just as good at
> so if one could get the same alsa modules which are used by aplay
> and arecord for setting up one's audio interfaces or sound cards,
> the manipulation of those data that was done in C could also be
> done in perl without hardly any modification to it at all.
> 
>       Perl has just the right mix of low-level logic and
> bitwise operators plus a much more easy-to-use string handling
> capability which is why I am asking this question.
> 
>       I may be looking in the wrong places but, so far, I seem
> to be batting zeros when looking for perl and alsa together.
>

you can try using an FFI, eg:

https://metacpan.org/dist/Inline-C/view/lib/Inline/C.pod

https://metacpan.org/dist/Inline-Python/view/Python.pod

https://metacpan.org/pod/FFI::Platypus
 
>       Any good ideas are greatly appreciated, here.
> 
>       Martin McCormick
> 



-- 

Shlomi Fish       https://www.shlomifish.org/
Selina Mandrake - The Slayer (Buffy parody) - https://shlom.in/selina

If the miller travelled to the market with Emma, they would have each rided
their own donkey. Problem solved.
    — https://www.shlomifish.org/humour/bits/facts/Emma-Watson/

Please reply to list if it's a mailing list post - https://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to