[Csnd] Problems with wgbrass

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] Problems with wgbrass

arunkumar
Hi,
I'm trying to connect an Arduino to Csound via MIDI. I'm having trouble getting the sounds to work for the wgbrass opcode. I've recreated the problem using sensekey, so it works from the keyboard instead of the Arduino.

i have my instrument 1 which increases and decreases the global frequency variable based on key presses
gkFreq init 200

gaSend init 0

instr 1
    k1  sensekey
    if k1 == 66 then ;down arrow key
        gkFreq = gkFreq - 10
    elseif k1 == 65 then ; up arrow key
        gkFreq = gkFreq + 10
    elseif k1 == 97 then ; 'a' key turns on instrument
    event "i", 2, 0, 4, gkFreq, 0.4, 0.1, 6.128
            ;this only works in this way. i can't set gkFreq directly in the instrument, but i need to pass it along as p variables to the instrument
    elseif k1 == 32 then ; spacebar turns off all instruments
turnoff2 2, 0, 1
    endif
    if gkFreq < 200 then
        gkFreq = 200
    elseif gkFreq > 1000 then
        gkFreq = 200
    endif
    printk2 gkFreq
endin

instr 2
  kamp = 0.5
  kfreq = p4
  ktens = p5
  iatt = p6
  kvibf = p7
  ifn = 1

  ; Create an amplitude envelope for the vibrato.
  kvamp line 0, p3, 0.5

  a1 wgbrass kamp, kfreq, ktens, iatt, kvibf, kvamp, ifn
  ;a1 wgbrass kamp, gkFreq, ktens, iatt, kvibf, kvamp, ifn ; this does not work
  ;a1 wgbrass kamp, 440, 0.4, 0.01, 6.137, kvamp, 1 ;setting values directly does not work either
  ;a1 oscil 0.6, gkFreq ;this works, i'm able to change the frequency of the oscillator.
  outs a1, a1
  gaSend = gaSend + a1/3
endin

the code for wgbrass i've taken from the example on the wgbrass opcode page - http://www.csounds.com/manual/html/wgbrass.html .

I have a similar setup which is working using the wgbow opcode which I've taken from here - http://write.flossmanuals.net/csound/g-physical-modelling/

I'm attaching both files to this email. bow.csd is the working example, and brass.csd is the one i'm having trouble with.

The behaviours i'm finding are that if i turn on the instrument repeatedly then i only hear clicks. i only hear clicks for a lot of the frequencies. I need to change frequency to hear a tone sometimes.

Can someone please explain what I'm doing wrong? I'm new to Csound.

Thanks for your time.

Regards,
arun
Csound mailing list [hidden email] 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

bow.csd (1K) Download Attachment
brass.csd (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Problems with wgbrass

jpff
Quick response.  Wgbrass has never worked well in my experience.  I got reasonable sounds when using a lower sample rate but never found what I suspect is a coding error.

Will look again later.

⁣Sent from TypeApp ​

On Jun 11, 2018, 10:07, at 10:07, Arun Kumar <[hidden email]> wrote:

>Hi,
>I'm trying to connect an Arduino to Csound via MIDI. I'm having trouble
>getting the sounds to work for the wgbrass opcode. I've recreated the
>problem using sensekey, so it works from the keyboard instead of the
>Arduino.
>
>i have my instrument 1 which increases and decreases the global
>frequency
>variable based on key presses
>gkFreq init 200
>
>gaSend init 0
>
>instr 1
>    k1  sensekey
>    if k1 == 66 then ;down arrow key
>        gkFreq = gkFreq - 10
>    elseif k1 == 65 then ; up arrow key
>        gkFreq = gkFreq + 10
>    elseif k1 == 97 then ; 'a' key turns on instrument
>    event "i", 2, 0, 4, gkFreq, 0.4, 0.1, 6.128
>           ;this only works in this way. i can't set gkFreq directly in
>the instrument, but i need to pass it along as p variables to the
>instrument
>    elseif k1 == 32 then ; spacebar turns off all instruments
>turnoff2 2, 0, 1
>    endif
>    if gkFreq < 200 then
>        gkFreq = 200
>    elseif gkFreq > 1000 then
>        gkFreq = 200
>    endif
>    printk2 gkFreq
>endin
>
>instr 2
>  kamp = 0.5
>  kfreq = p4
>  ktens = p5
>  iatt = p6
>  kvibf = p7
>  ifn = 1
>
>  ; Create an amplitude envelope for the vibrato.
>  kvamp line 0, p3, 0.5
>
>  a1 wgbrass kamp, kfreq, ktens, iatt, kvibf, kvamp, ifn
>;a1 wgbrass kamp, gkFreq, ktens, iatt, kvibf, kvamp, ifn ; this does
>not
>work
>  ;a1 wgbrass kamp, 440, 0.4, 0.01, 6.137, kvamp, 1 ;setting values
>directly does not work either
> ;a1 oscil 0.6, gkFreq ;this works, i'm able to change the frequency of
>the oscillator.
>  outs a1, a1
>  gaSend = gaSend + a1/3
>endin
>
>the code for wgbrass i've taken from the example on the wgbrass opcode
>page
>- http://www.csounds.com/manual/html/wgbrass.html .
>
>I have a similar setup which is working using the wgbow opcode which
>I've
>taken from here -
>http://write.flossmanuals.net/csound/g-physical-modelling/
>
>I'm attaching both files to this email. bow.csd is the working example,
>and
>brass.csd is the one i'm having trouble with.
>
>The behaviours i'm finding are that if i turn on the instrument
>repeatedly
>then i only hear clicks. i only hear clicks for a lot of the
>frequencies. I
>need to change frequency to hear a tone sometimes.
>
>Can someone please explain what I'm doing wrong? I'm new to Csound.
>
>Thanks for your time.
>
>Regards,
>arun
>
>Csound mailing list
>[hidden email]
>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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Problems with wgbrass

arunkumar
Hi John,
Thanks for your quick response. I will experiment with lower sample rates
and see if that helps.

>Quick response.  Wgbrass has never worked well in my experience.  I got
reasonable sounds when using a lower sample rate but never found what I
suspect is a coding error.

>Will look again later.



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
[hidden email]
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