Csound Csound-dev Csound-tekno Search About

[Csnd] 1. exciter 2. odd and even

Date2013-10-05 15:20
Fromorebronerd
Subject[Csnd] 1. exciter 2. odd and even
Two questions that I hope the community can help me with:
1. Are there any opcodes for exciter functions, to intelligently add
harmonics? I use it sometimes when I pitch down samples.

2. I have a loop with an index that increments with 1. I want to do
different things on odd and even numbers. 
If index = odd then
bla bla bla
elseif index = even then
bla bla bla

My school math is many years away. Is there some easy solution to solve this
within csound? I have looked in the math expressions department but didn´t
come up with any ideas.

Thank you in advance.



--
View this message in context: http://csound.1045644.n5.nabble.com/1-exciter-2-odd-and-even-tp5728112.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2013-10-05 16:00
Fromjpff@cs.bath.ac.uk
SubjectRe: [Csnd] 1. exciter 2. odd and even
> 2. I have a loop with an index that increments with 1. I want to do
> different things on odd and even numbers.
> If index = odd then
> bla bla bla
> elseif index = even then
> bla bla bla
>
> My school math is many years away. Is there some easy solution to solve
> this
> within csound? I have looked in the math expressions department but
> didn´t
> come up with any ideas.
>

Many wayds

if (index&1)==0 then
   evem case
else
   oddcase
endif

or

iparity inir 0
....

in loop

iparity += 1
if parity>2 parity = 0
....





Date2013-10-05 16:13
FromAnders Genell
SubjectRe: [Csnd] 1. exciter 2. odd and even
Huh, I immediately thought

if (index%2)==1 then
    Odd
else
    Even
endif


Fun to see methods I wouldn't think of...

/A

5 okt 2013 kl. 17:00 skrev jpff@cs.bath.ac.uk:

>> 2. I have a loop with an index that increments with 1. I want to do
>> different things on odd and even numbers.
>> If index = odd then
>> bla bla bla
>> elseif index = even then
>> bla bla bla
>> 
>> My school math is many years away. Is there some easy solution to solve
>> this
>> within csound? I have looked in the math expressions department but
>> didn´t
>> come up with any ideas.
> 
> Many wayds
> 
> if (index&1)==0 then
>   evem case
> else
>   oddcase
> endif
> 
> or
> 
> iparity inir 0
> ....
> 
> in loop
> 
> iparity += 1
> if parity>2 parity = 0
> ....
> 
> 
> 
> 
> 
> 
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>            https://sourceforge.net/p/csound/tickets/
> csound5:
>            https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 


Date2013-10-05 16:36
FromJim Aikin
Subject[Csnd] Re: 1. exciter 2. odd and even
> 1. Are there any opcodes for exciter functions, to intelligently add
harmonics? I use
> it sometimes when I pitch down samples. 

I've never tried it with samples, but I think chebyshevpoly would be worth
trying. Possibly with subtle values for the coefficients.



--
View this message in context: http://csound.1045644.n5.nabble.com/1-exciter-2-odd-and-even-tp5728112p5728117.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-10-06 09:42
Fromorebronerd
Subject[Csnd] Re: 1. exciter 2. odd and even
Thank you for your help. Both solutions about odd and even worked fine. The
modulus example I can understand why it works, but the bitwise example I
don´t understand at the moment. I have to read some more. :-)
The chebyshevpoly opcode is interesting. It requires a bit of manual work
and testing, that a traditional exciter does automatically, but it will work
fine for my recent project. 



--
View this message in context: http://csound.1045644.n5.nabble.com/1-exciter-2-odd-and-even-tp5728112p5728123.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2013-10-06 12:00
Fromjpff@cs.bath.ac.uk
SubjectRe: [Csnd] Re: 1. exciter 2. odd and even
> Thank you for your help. Both solutions about odd and even worked fine.
> The
> modulus example I can understand why it works, but the bitwise example I
> don´t understand at the moment. I have to read some more. :-)

The bitwise version works because yoi are using a binary computer where
numbers are represented base 2.  So any even number does not have a 2^0
(ie 1) part in its binary representation.

In 3 bits

000   0   even   bottom bit alternates
001   1   odd
010   2   even
011   3   odd
100   4    etc
101   5
110   6
111   7