Csound Csound-dev Csound-tekno Search About

[Csnd] audio input question

Date2020-06-23 17:47
FromDave Seidel
Subject[Csnd] audio input question
Hi all,

What is the fastest and least resource-intensive way to test of there is anything coming in on an input channel (ie, opened with "inch")? I figure I could use probably the rms opcode and check for a 0 output value, but maybe there's a better, simpler way.

Context: I'm writing more coe for the Nebulae module, this time an effect as opposed to an instrument, so it will be taking audio input, processing it, and sending the result out. I want to be able to use a different code path based on whether both inputs are being used, or just one. The Nebulae is powered by a Raspberry Pi 3, and I'm using pvs opcodes, so I want to be careful to make the code as efficient as possible.

Thanks,
Dave
Csound mailing list Csound@listserv.heanet.ie 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

Date2020-06-23 17:58
FromJustin Smith
SubjectRe: [Csnd] audio input question
unless there's a switch on the DSP to turn the input off in software,
checking for 0 doesn't suffice, because an ADC still has noise at some
level even with no source provided

the strictly most optimized solution would be picking a different
instrument (or even a different CSD) at startup based on some
statically detectable condition (eg. a switch position on the device
on boot) - any conditionals in the instrument itself are using cycles
that could be used for DSP

On Tue, Jun 23, 2020 at 9:47 AM Dave Seidel  wrote:
>
> Hi all,
>
> What is the fastest and least resource-intensive way to test of there is anything coming in on an input channel (ie, opened with "inch")? I figure I could use probably the rms opcode and check for a 0 output value, but maybe there's a better, simpler way.
>
> Context: I'm writing more coe for the Nebulae module, this time an effect as opposed to an instrument, so it will be taking audio input, processing it, and sending the result out. I want to be able to use a different code path based on whether both inputs are being used, or just one. The Nebulae is powered by a Raspberry Pi 3, and I'm using pvs opcodes, so I want to be careful to make the code as efficient as possible.
>
> Thanks,
> Dave
> Csound mailing list Csound@listserv.heanet.ie 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
Csound@listserv.heanet.ie
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

Date2020-06-23 18:16
FromDave Seidel
SubjectRe: [Csnd] audio input question
Good points, Justin, and I do have latching front panel switches available,

On Tue, Jun 23, 2020 at 12:58 PM Justin Smith <noisesmith@gmail.com> wrote:
unless there's a switch on the DSP to turn the input off in software,
checking for 0 doesn't suffice, because an ADC still has noise at some
level even with no source provided

the strictly most optimized solution would be picking a different
instrument (or even a different CSD) at startup based on some
statically detectable condition (eg. a switch position on the device
on boot) - any conditionals in the instrument itself are using cycles
that could be used for DSP

On Tue, Jun 23, 2020 at 9:47 AM Dave Seidel <dave.seidel@gmail.com> wrote:
>
> Hi all,
>
> What is the fastest and least resource-intensive way to test of there is anything coming in on an input channel (ie, opened with "inch")? I figure I could use probably the rms opcode and check for a 0 output value, but maybe there's a better, simpler way.
>
> Context: I'm writing more coe for the Nebulae module, this time an effect as opposed to an instrument, so it will be taking audio input, processing it, and sending the result out. I want to be able to use a different code path based on whether both inputs are being used, or just one. The Nebulae is powered by a Raspberry Pi 3, and I'm using pvs opcodes, so I want to be careful to make the code as efficient as possible.
>
> Thanks,
> Dave
> Csound mailing list Csound@listserv.heanet.ie 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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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

Date2020-06-23 18:41
From"Jeanette C."
SubjectRe: [Csnd] audio input question
Jun 23 2020, Dave Seidel has written:

> Good points, Justin, and I do have latching front panel switches available,
To keep it a little more flexible, you could use a control instrument
that would run two other iinstruments based on a switch position. Using
changed2() you could wait for changes and decide whether to turn off one
instrument and turn on the other.

Best wishes,

Jeanette
>
> On Tue, Jun 23, 2020 at 12:58 PM Justin Smith  wrote:
>
>> unless there's a switch on the DSP to turn the input off in software,
>> checking for 0 doesn't suffice, because an ADC still has noise at some
>> level even with no source provided
>>
>> the strictly most optimized solution would be picking a different
>> instrument (or even a different CSD) at startup based on some
>> statically detectable condition (eg. a switch position on the device
>> on boot) - any conditionals in the instrument itself are using cycles
>> that could be used for DSP
>>
>> On Tue, Jun 23, 2020 at 9:47 AM Dave Seidel  wrote:
>>>
>>> Hi all,
>>>
>>> What is the fastest and least resource-intensive way to test of there is
>> anything coming in on an input channel (ie, opened with "inch")? I figure I
>> could use probably the rms opcode and check for a 0 output value, but maybe
>> there's a better, simpler way.
>>>
>>> Context: I'm writing more coe for the Nebulae module, this time an
>> effect as opposed to an instrument, so it will be taking audio input,
>> processing it, and sending the result out. I want to be able to use a
>> different code path based on whether both inputs are being used, or just
>> one. The Nebulae is powered by a Raspberry Pi 3, and I'm using pvs opcodes,
>> so I want to be careful to make the code as efficient as possible.
>>>
>>> Thanks,
>>> Dave
>>> Csound mailing list Csound@listserv.heanet.ie
>> 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
>> Csound@listserv.heanet.ie
>> 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
> Csound@listserv.heanet.ie
> 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
>

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Twitter: https://twitter.com/jeanette_c_s
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

I used to think
I had the answers to everything
But now I know
... :) <3
(Britney Spears)

Csound mailing list
Csound@listserv.heanet.ie
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

Date2020-06-23 19:04
FromDave Seidel
SubjectRe: [Csnd] audio input question
Thanks, Jeanette, excellent idea.

By the way, I ended up using ftmorf in my Risset Harmonic Oscillator instrument (and I thanked you in the README).
The risset.instr is the code, it's really just a Csound ORC.

- Dave

On Tue, Jun 23, 2020 at 1:41 PM Jeanette C. <julien@mail.upb.de> wrote:
Jun 23 2020, Dave Seidel has written:

> Good points, Justin, and I do have latching front panel switches available,
To keep it a little more flexible, you could use a control instrument
that would run two other iinstruments based on a switch position. Using
changed2() you could wait for changes and decide whether to turn off one
instrument and turn on the other.

Best wishes,

Jeanette
>
> On Tue, Jun 23, 2020 at 12:58 PM Justin Smith <noisesmith@gmail.com> wrote:
>
>> unless there's a switch on the DSP to turn the input off in software,
>> checking for 0 doesn't suffice, because an ADC still has noise at some
>> level even with no source provided
>>
>> the strictly most optimized solution would be picking a different
>> instrument (or even a different CSD) at startup based on some
>> statically detectable condition (eg. a switch position on the device
>> on boot) - any conditionals in the instrument itself are using cycles
>> that could be used for DSP
>>
>> On Tue, Jun 23, 2020 at 9:47 AM Dave Seidel <dave.seidel@gmail.com> wrote:
>>>
>>> Hi all,
>>>
>>> What is the fastest and least resource-intensive way to test of there is
>> anything coming in on an input channel (ie, opened with "inch")? I figure I
>> could use probably the rms opcode and check for a 0 output value, but maybe
>> there's a better, simpler way.
>>>
>>> Context: I'm writing more coe for the Nebulae module, this time an
>> effect as opposed to an instrument, so it will be taking audio input,
>> processing it, and sending the result out. I want to be able to use a
>> different code path based on whether both inputs are being used, or just
>> one. The Nebulae is powered by a Raspberry Pi 3, and I'm using pvs opcodes,
>> so I want to be careful to make the code as efficient as possible.
>>>
>>> Thanks,
>>> Dave
>>> Csound mailing list Csound@listserv.heanet.ie
>> 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
>> Csound@listserv.heanet.ie
>> 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
> Csound@listserv.heanet.ie
> 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
>

--
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Twitter: https://twitter.com/jeanette_c_s
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

I used to think
I had the answers to everything
But now I know
... :) <3
(Britney Spears)

Csound mailing list
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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