Csound Csound-dev Csound-tekno Search About

[Csnd] newbie questions

Date2021-03-22 15:42
FromTom Peters
Subject[Csnd] newbie questions
;-+rtaudio=alsa -odac -d ;-o tmp.wav -W ; for file output any platform ; Orchestra: ; defaults: kr = 4410 ksmps = 10 sr = 44100 nchnls = 2 0dbfs = 1 instr 1 iDur=p3-p2 ; duration of note iFreq=p4 ; base frequency iNote=p5 ; ratio for note in ladder iAmp=0.25 ; ADSR envelope parameters: iAtt=0.1 iDec=0.2 iSus=0.7 iRel=0.2 kEnv madsr iAtt, iDec, iSus, iRel aSig oscils iAmp, iFreq*iNote, 0, 0 ;outs aSig, aSig outs aSig*kEnv, aSig*kEnv endin ;f 1 0 1024 10 1 ; GEN10 with 1 single sine wave ; A-major scale in just intonation: i 1 0 1 440 [1/1] i 1 1 1 440 [9/8] i 1 2 1 440 [5/4] i 1 3 1 440 [4/3] i 1 4 1 440 [3/2] i 1 5 1 440 [5/3] i 1 6 1 440 [7/4] i 1 7 1 440 [2/1] ; Pythagorean seventh chord i 1 9 2 440 [1/1] i 1 9 2 440 [81/64] i 1 9 2 440 [3/2] i 1 9 2 440 [16/9] ; Harmonic seventh chord i 1 12 2 440 [1/1] i 1 12 2 440 [5/4] i 1 12 2 440 [3/2] i 1 12 2 440 [7/4] e 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

Date2021-03-22 16:27
From"Jeanette C."
SubjectRe: [Csnd] newbie questions
Hi Tom,
I can only answer a few of these. Maybe it helps. :)
Mar 22 2021, Tom Peters has written:
...
> 3) I apply the ADSR envelope at the output, twice, which I think is not logical or optimal. The examples suggest to apply it to the amplitude parameter but that does not work with oscils. Please advise.
It does not work with oscils, because it only allows for constant volume
(iamp instead of kamp, aamp or xamp). xsomething means that the
parameter can be i-rate, k-rate or a-rate, usually.
You can use oscil or poscil. Or with osils:
aOscil = oscils(iAmp, iCps,, iPhase)
aOscil *= kAdsr
>
> 4) Is there a neater way to sound a chord of specified frequencies without running the instrument multiple times at the same time point?
Depends. It's the way a hardware synth would do it, allocate one
complete voice for a note.

If you have a very simple and restricted use case, i.e. always three
note chords, you could put three oscillators into one instrument and
have three parameters for the three different notes.

Or you could double wrap: create one instrument that plays one note,
write another instrument that will call the first instrument three times
and that accepts three not values.

Or you can work with arrays and write a UDO (User defined opcode) that
calls itself recursively...
>
> 5) I am confused if, when, and how to use a table to generate an oscillation: in some of the examples I do not see how it is used in the instrument or how the frequency is applied. Some directives?
...
There are many different oscillators. Some fall under the "f-table"
based oscillators. Something like vco2 brings its own waveforms, oscils
comes with a default waveform. Also many - if not all - oscil* opcodes
can default to playing a sine wave, if the ftable parameter is -1 . It's
a shortcut for convenience. It's something to get used to. Soon you'll
know the basic oscillator families and when to look for what.

I have no idea, how things are organised in CsoundQT, maybe there are
pointers.

HTH, best wishes,

Jeanette

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

She's so lucky,
she's a star
But she cry, cry, cries in her lonely heart... <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

Date2021-03-22 16:48
FromJohn ff
SubjectRe: [Csnd] newbie questions
I am not sure of the questions as your message was totally garbledin my inbox.  However regarding q4 there is no problem in going

instr 1
a1 oscil p4, p5
a2 oscil p4, p6
a3 ocsil p4, p7
out a1+a2+a3
endin

and activating it with 

i1 0 3, 0.2, 440, 660, 880

or an enything like that

If I understand the problem


⁣Sent from TypeApp ​

On Mar 22, 2021, 16:28, at 16:28, "Jeanette C."  wrote:
>Hi Tom,
>I can only answer a few of these. Maybe it helps. :)
>Mar 22 2021, Tom Peters has written:
>...
>> 3) I apply the ADSR envelope at the output, twice, which I think is
>not logical or optimal. The examples suggest to apply it to the
>amplitude parameter but that does not work with oscils. Please advise.
>It does not work with oscils, because it only allows for constant
>volume
>(iamp instead of kamp, aamp or xamp). xsomething means that the
>parameter can be i-rate, k-rate or a-rate, usually.
>You can use oscil or poscil. Or with osils:
>aOscil = oscils(iAmp, iCps,, iPhase)
>aOscil *= kAdsr
>>
>> 4) Is there a neater way to sound a chord of specified frequencies
>without running the instrument multiple times at the same time point?
>Depends. It's the way a hardware synth would do it, allocate one
>complete voice for a note.
>
>If you have a very simple and restricted use case, i.e. always three
>note chords, you could put three oscillators into one instrument and
>have three parameters for the three different notes.
>
>Or you could double wrap: create one instrument that plays one note,
>write another instrument that will call the first instrument three
>times
>and that accepts three not values.
>
>Or you can work with arrays and write a UDO (User defined opcode) that
>calls itself recursively...
>>
>> 5) I am confused if, when, and how to use a table to generate an
>oscillation: in some of the examples I do not see how it is used in the
>instrument or how the frequency is applied. Some directives?
>...
>There are many different oscillators. Some fall under the "f-table"
>based oscillators. Something like vco2 brings its own waveforms, oscils
>comes with a default waveform. Also many - if not all - oscil* opcodes
>can default to playing a sine wave, if the ftable parameter is -1 .
>It's
>a shortcut for convenience. It's something to get used to. Soon you'll
>know the basic oscillator families and when to look for what.
>
>I have no idea, how things are organised in CsoundQT, maybe there are
>pointers.
>
>HTH, best wishes,
>
>Jeanette
>
>-- 
>  * Website: http://juliencoder.de - for summer is a state of sound
>  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
>  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
>  * GitHub: https://github.com/jeanette-c
>
>She's so lucky,
>she's a star
>But she cry, cry, cries in her lonely heart... <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