Csound Csound-dev Csound-tekno Search About

[Csnd] distortion problem with harmon2

Date2008-01-31 21:56
FromAtte André Jensen
Subject[Csnd] distortion problem with harmon2
Hi

(sorry if this message have been posted before, I just switched linux-distro and having problems with the mail-client)

I'm trying to build an autotune instrument using harmon2. However, I get
a nasty distortion whenever I apply harmon2, even with freq = 1 (so no
transposition). So I'm hoping I'm just
doing something wrong. Any input appreciated, esp from anyone with
succesful experiences with harmon2...

Here's a short sniplet of audio to let you hear what I mean (first one
is original audio, the second is through harmon2):

http://atte.dk/download/clean.mp3
http://atte.dk/download/harmon2.mp3

I developing it all in blue as a Effect, so if anyone's running blue,
heres a .blue with the code + the vocal sample:

http://atte.dk/download/harmon2.zip

here's the code I use:

; setup for delay
idelay = .045
; setup for the spectrum opcode
iprd = .01; .02
iocts = 7
ifrqa = 24;24
iq = 12;12
ihann = 1
idbout = 3
; setup for the specptrk opcode
kvar = 1
ilo = 6.5
ihi = 9.5
istr = 7.5
idbthresh = 10
idbthresh = 0
inptls = 7
irolloff = .7
iodd = 0
iconfs = 3
interpol = 1
; setup for the harmon2 opcode
kfrq1 = 1
kfrq2 = 0
icpsmode = 0
ilowest = 4.9
ipolarity = 0;1
afilt1 tone ain1, 10000
afilt2 tone ain2, 10000
w1 spectrum afilt1, iprd, iocts, ifrqa, iq, ihann, idbout
w2 spectrum afilt2, iprd, iocts, ifrqa, iq, ihann, idbout
koct1,kamp1 specptrk w1, kvar, ilo, ihi, istr, idbthresh, inptls,
irolloff, iodd, iconfs, interpol
koct2,kamp2 specptrk w2, kvar, ilo, ihi, istr, idbthresh, inptls,
irolloff, iodd, iconfs, interpol
ain1 delay ain1, idelay
ain2 delay ain2, idelay
aout1 harmon2 ain1, koct1, kfrq1, kfrq2, icpsmode, ilowest;, ipolarity
aout2 harmon2 ain2, koct2, kfrq1, kfrq2, icpsmode, ilowest;, ipolarity

-- 
peace, love & harmony
Atte

http://atte.dk       | http://myspace.com/attejensen 
http://anagrammer.dk | http://modlys.dk


Date2008-01-31 22:45
FromTim Mortimer
Subject[Csnd] Re: distortion problem with harmon2
I also tried using Harmon2 as a basis for a pitch shift delay, & had a
similar result

i assumed it was because my input was too complex, & moved on...(i was
trying to build a pitch shift delay with feedback - my next attempt was to
involve writing the signal to a table & trying a pitch shifted grains
approach instead...)

i watch therefore with interest...

T.


Atte wrote:
> 
> Hi
> 
> (sorry if this message have been posted before, I just switched
> linux-distro and having problems with the mail-client)
> 
> I'm trying to build an autotune instrument using harmon2. However, I get
> a nasty distortion whenever I apply harmon2, even with freq = 1 (so no
> transposition). So I'm hoping I'm just
> doing something wrong. Any input appreciated, esp from anyone with
> succesful experiences with harmon2...
> 
> Here's a short sniplet of audio to let you hear what I mean (first one
> is original audio, the second is through harmon2):
> 
> http://atte.dk/download/clean.mp3
> http://atte.dk/download/harmon2.mp3
> 
> I developing it all in blue as a Effect, so if anyone's running blue,
> heres a .blue with the code + the vocal sample:
> 
> http://atte.dk/download/harmon2.zip
> 
> here's the code I use:
> 
> ; setup for delay
> idelay = .045
> ; setup for the spectrum opcode
> iprd = .01; .02
> iocts = 7
> ifrqa = 24;24
> iq = 12;12
> ihann = 1
> idbout = 3
> ; setup for the specptrk opcode
> kvar = 1
> ilo = 6.5
> ihi = 9.5
> istr = 7.5
> idbthresh = 10
> idbthresh = 0
> inptls = 7
> irolloff = .7
> iodd = 0
> iconfs = 3
> interpol = 1
> ; setup for the harmon2 opcode
> kfrq1 = 1
> kfrq2 = 0
> icpsmode = 0
> ilowest = 4.9
> ipolarity = 0;1
> afilt1 tone ain1, 10000
> afilt2 tone ain2, 10000
> w1 spectrum afilt1, iprd, iocts, ifrqa, iq, ihann, idbout
> w2 spectrum afilt2, iprd, iocts, ifrqa, iq, ihann, idbout
> koct1,kamp1 specptrk w1, kvar, ilo, ihi, istr, idbthresh, inptls,
> irolloff, iodd, iconfs, interpol
> koct2,kamp2 specptrk w2, kvar, ilo, ihi, istr, idbthresh, inptls,
> irolloff, iodd, iconfs, interpol
> ain1 delay ain1, idelay
> ain2 delay ain2, idelay
> aout1 harmon2 ain1, koct1, kfrq1, kfrq2, icpsmode, ilowest;, ipolarity
> aout2 harmon2 ain2, koct2, kfrq1, kfrq2, icpsmode, ilowest;, ipolarity
> 
> -- 
> peace, love & harmony
> Atte
> 
> http://atte.dk       | http://myspace.com/attejensen 
> http://anagrammer.dk | http://modlys.dk
> 
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
> 
> 


-----
*******************
www.phasetransitions.net
hermetic music * python * csound * possibly mindless ranting
various werk in perpetual delusions of progress....
coming soon.....

-- 
View this message in context: http://www.nabble.com/distortion-problem-with-harmon2-tp15215779p15216623.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2008-02-01 15:41
FromAtte André Jensen
Subject[Csnd] Re: Re: distortion problem with harmon2
Tim Mortimer wrote:

> I also tried using Harmon2 as a basis for a pitch shift delay, & had a
> similar result

:-(

Anyone else had any luck with harmon2-4?

> i assumed it was because my input was too complex, & moved on...(i was
> trying to build a pitch shift delay with feedback - my next attempt was to
> involve writing the signal to a table & trying a pitch shifted grains
> approach instead...)

Did you succeed? I thought about the same, but can't figure out how use 
the granular opcodes with an audio stream (as opposed to a sample read 
into a ftable)...

-- 
peace, love & harmony
Atte

http://atte.dk       | http://myspace.com/attejensen
http://anagrammer.dk | http://modlys.dk

Date2008-02-01 16:04
FromRory Walsh
Subject[Csnd] Re: Re: Re: distortion problem with harmon2
> Did you succeed? I thought about the same, but can't figure out how use 
> the granular opcodes with an audio stream (as opposed to a sample read 
> into a ftable)...

I haven't been following this thread but can't you write the audio 
stream to an ftable? I built a simple real-time granular instrument some 
time back that does this. Is that what you mean?

Date2008-02-01 16:18
FromAtte André Jensen
Subject[Csnd] Re: Re: Re: Re: distortion problem with harmon2
Rory Walsh wrote:

> I haven't been following this thread but can't you write the audio 
> stream to an ftable? I built a simple real-time granular instrument some 
> time back that does this. Is that what you mean?

Yeah, how do I do that? Just a quick pointer would be fine...

-- 
peace, love & harmony
Atte

http://atte.dk       | http://myspace.com/attejensen
http://anagrammer.dk | http://modlys.dk

Date2008-02-01 16:28
FromRory Walsh
Subject[Csnd] Re: Re: Re: Re: Re: distortion problem with harmon2
You can use a tablew opcode to write to a table, then you pass that 
table to one of the grain opcodes. Of course it's not exactly real-time, 
but it might provide some inspiration. I can post some code if you like, 
or perhaps you would like to have a shot at it yourself first?

Rory.



Atte André Jensen wrote:
> Rory Walsh wrote:
> 
>> I haven't been following this thread but can't you write the audio 
>> stream to an ftable? I built a simple real-time granular instrument 
>> some time back that does this. Is that what you mean?
> 
> Yeah, how do I do that? Just a quick pointer would be fine...
> 

Date2008-02-01 16:55
From"Steven Yi"
Subject[Csnd] Re: Re: Re: distortion problem with harmon2
AttachmentsNone  

Date2008-02-01 17:09
FromAtte André Jensen
Subject[Csnd] Re: Re: Re: Re: distortion problem with harmon2
Steven Yi wrote:

> I remember trying out an example when they first got put into Csound
> and remember them working at the time.

Which according to the manual was 2006...

> I think that it'd be very bad
> if they were broken!

Exactly. Right now I'm mostly interested in knowing if it's me or 
harmon2 that's doing something wrong. Would it be inappropriate to 
contact Barry to hear his opinion on the state of harmon2?

-- 
peace, love & harmony
Atte

http://atte.dk       | http://myspace.com/attejensen
http://anagrammer.dk | http://modlys.dk

Date2008-02-01 23:16
FromTim Mortimer
Subject[Csnd] Re: Re: distortion problem with harmon2
As far as a pitch shifting grain delay goes - no, not yet

I got Michael Bechard to send me his "Granularise" effect code (which is in
Blueshare - i signed up, but couldn't work out how to access the code -
there seems to be a place for everything - but nothing is in its place?) &
gave it a brief reshuffle yesterday..

writing an asig to an ftable is fine (i think), but im not sure how to
resolve any discontinuities that might appear within the grain during
playback (possibly the answer is to use 2 tables, one for writing & one for
playback - how to sync the table copying though to phasor input cycles?)

Anyway, on & on I go.. there's a lot of hidden complexity to the task & i;ll
be trying to address it one step at a time - but as usual i have about 10
things i'm trying to do in csound at once - & what i end up addressing on
any given day can be a bit of a whim in the end...(& largely subject to what
i can get working & what i can't...)

on the upside - this is not some general "grab" at a grain delay - i know
specifically the type of effect im after & if anyone knows the GRM pitch
accum plugin that's basically what i'm looking to emulate as part of my
ambient pad synth "effects rack"...


Atte wrote:
> 
> Tim Mortimer wrote:
> 
> 
> Did you succeed? I thought about the same, but can't figure out how use 
> the granular opcodes with an audio stream (as opposed to a sample read 
> into a ftable)...
> 
> -- 
> peace, love & harmony
> Atte
> 
> http://atte.dk       | http://myspace.com/attejensen
> http://anagrammer.dk | http://modlys.dk
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
> 
> 


-----
*******************
www.phasetransitions.net
hermetic music * python * csound * possibly mindless ranting
various werk in perpetual delusions of progress....
coming soon.....

-- 
View this message in context: http://www.nabble.com/distortion-problem-with-harmon2-tp15215779p15235068.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2008-02-01 23:25
FromTim Mortimer
Subject[Csnd] Re: distortion problem with harmon2
Hi Rory,

I'd like to see yor example - or others like it involving capturing audio &
then using grains to pitch shift.

I may simply need to mod it.

I have a reasonably clear idea about how the GRM effect works & intend to
basically model it on that (it more or less uses it's audio buffer as a
windowed grain in its own right it seems - so if you capture a second of
audio & play it back at +12 you get the audio you captured played back
twice, with a small discontinuity assumedly where the window for recording
the audio ramped up & down (again to prevent discontinuities)

it features feedback & various stereo parameters though, & i also might need
to filter the feedback loop at around 12k or so to again try & take some
precautions against ye old nyquist flippage....

In the future, perhaps a fully fledged partikkel delay will be explored...(i
think Oeyvind already has something like it - i flipped through some of
partikkel explorer yesterday - but being such a comprehensive environment in
it's own right it's a bit hard to gut & fillet without some degree of prior
intimacy (what a horrible metaphoric mix that is...))



rory walsh wrote:
> 
> You can use a tablew opcode to write to a table, then you pass that 
> table to one of the grain opcodes. Of course it's not exactly real-time, 
> but it might provide some inspiration. I can post some code if you like, 
> or perhaps you would like to have a shot at it yourself first?
> 
> Rory.
> 
> 
> 
> Atte André Jensen wrote:
>> Rory Walsh wrote:
>> 
>>> I haven't been following this thread but can't you write the audio 
>>> stream to an ftable? I built a simple real-time granular instrument 
>>> some time back that does this. Is that what you mean?
>> 
>> Yeah, how do I do that? Just a quick pointer would be fine...
>> 
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
> 
> 


-----
*******************
www.phasetransitions.net
hermetic music * python * csound * possibly mindless ranting
various werk in perpetual delusions of progress....
coming soon.....

-- 
View this message in context: http://www.nabble.com/distortion-problem-with-harmon2-tp15215779p15235455.html
Sent from the Csound - General mailing list archive at Nabble.com.



Date2008-02-01 23:27
FromVictor.Lazzarini@nuim.ie
Subject[Csnd] Re: Re: Re: distortion problem with harmon2
AttachmentsNone  None  

Date2008-02-02 02:37
From"Steven Yi"
Subject[Csnd] Re: Re: Re: distortion problem with harmon2
AttachmentsNone  

Date2008-02-02 04:06
From"Steven Yi"
Subject[Csnd] Re: Re: Re: Re: Re: distortion problem with harmon2
AttachmentsNone  harmon234.csd  

Date2008-02-02 10:18
FromTim Mortimer
Subject[Csnd] Re: Re: Re: distortion problem with harmon2
No problems Steven.

I don't have Blue installed on this computer (my "net machine" being a
clunky ol win 2000 jobby that crashes more often than not during some task
or other...), & was really just looking to "mine" the csound code... hence
my confusion at the presentation online...

I'm beginning to think about replacing this ol clunker therefore with a
linux job - do all my net stuff using linux & then i'll have a way to
introduce myself to a Linux environment & somewhere toy with some Linux
audio apps (& try compiling csound etc) in the process...

could still be a way off though... as I'm also thinking about maybe moving
to Cairns.... any Csounders in Cairns? sing out if youre out there....




Steven Yi wrote:
> 
> Hi Tim,
> 
> Just a note about blueShare, you only need to go to the site to sign
> up for an account and to subscribe to the RSS feeds.  You also only
> need to sign up for an account if you're going to submit an instrument
> or effect.  To upload or download instruments and effects, you do that
> all within blue itself.
> 
> Thanks,
> steven
> 
> On Feb 1, 2008 3:16 PM, Tim Mortimer  wrote:
> 


-----
*******************
www.phasetransitions.net
hermetic music * python * csound * possibly mindless ranting
various werk in perpetual delusions of progress....
coming soon.....

-- 
View this message in context: http://www.nabble.com/distortion-problem-with-harmon2-tp15215779p15241471.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2008-02-02 11:24
FromRory Walsh
Subject[Csnd] Re: Re: distortion problem with harmon2
Here you go. It runs ok but there may be a few problems with, I never 
really got into it.



-odevaudio1 -b10 -idevaudio


sr = 44100
kr = 44100
ksmps = 1
nchnls = 1

;//create ftable to hold audio samples
gi1 ftgen  1, 0, 16384, 7, 0, 16384, 0
;//create ftable to crossfade...
gi2 ftgen  2, 0, 16384, 7, 0, 100, 1, 16184, 1, 100, 0

opcode liveGrain, a, akkkkkiiiii
       setksmps 1
asig, kpitch,kdens,kaoff,kpoff,kgdur,ifn,iwin,imaxgdur,ifn,icrx xin
kwp init 0
awp = kwp
ilen = ftlen(ifn)
     kcrx table kwp, icrx
     asig = asig*kcrx+asig*(kcrx-1)
     tablew asig, awp, ifn
     ar  grain 1, kpitch, kdens, kaoff, kpoff, kgdur, ifn, iwin, 
imaxgdur, 0
     amix = ar
kwp = kwp + 1
if kwp > ilen then
kwp = 0
endif
xout amix
endop

instr 1
asig soundin "D:/MyDocuments/csoundfiles/Old/a_voice.wav"
;asig in
ifn  = 1
iwin = 3
kpitch = 44100 / ftlen(ifn)   ; Use original sample rate of insnd file
kdens  = 100
kaoff  = 0.5
kpoff  = 5
kgdur  = .01
imaxgdur =  1
icrx = 2
aout liveGrain asig, kpitch, kdens, kaoff, kpoff, kgdur, ifn, iwin, 
imaxgdur, ifn, icrx
out aout
endin



f3  0 512  20 2;
i1 0 100




Tim Mortimer wrote:
> Hi Rory,
> 
> I'd like to see yor example - or others like it involving capturing audio &
> then using grains to pitch shift.
> 
> I may simply need to mod it.
> 
> I have a reasonably clear idea about how the GRM effect works & intend to
> basically model it on that (it more or less uses it's audio buffer as a
> windowed grain in its own right it seems - so if you capture a second of
> audio & play it back at +12 you get the audio you captured played back
> twice, with a small discontinuity assumedly where the window for recording
> the audio ramped up & down (again to prevent discontinuities)
> 
> it featur

Date2008-02-02 15:34
From"Dr. Richard Boulanger"
Subject[Csnd] Re: Re: Re: distortion problem with harmon2
Rory,

Super instrument and UDO.  Thanks for sharing.  (You might add it to  
your blog at cSounds.com too?)
PS: On the intel Mac, I needed to change the -b10 to get it to run  
clean.


Dr. B.

On Feb 2, 2008, at 6:24 AM, Rory Walsh wrote:

> Here you go. It runs ok but there may be a few problems with, I  
> never really got into it.
>
> 
> 
> -odevaudio1 -b10 -idevaudio
> 
> 
> sr = 44100
> kr = 44100
> ksmps = 1
> nchnls = 1
>
> ;//create ftable to hold audio samples
> gi1 ftgen  1, 0, 16384, 7, 0, 16384, 0
> ;//create ftable to crossfade...
> gi2 ftgen  2, 0, 16384, 7, 0, 100, 1, 16184, 1, 100, 0
>
> opcode liveGrain, a, akkkkkiiiii
>       setksmps 1
> asig, kpitch,kdens,kaoff,kpoff,kgdur,ifn,iwin,imaxgdur,ifn,icrx xin
> kwp init 0
> awp = kwp
> ilen = ftlen(ifn)
>     kcrx table kwp, icrx
>     asig = asig*kcrx+asig*(kcrx-1)
>     tablew asig, awp, ifn
>     ar  grain 1, kpitch, kdens, kaoff, kpoff, kgdur, ifn, iwin,  
> imaxgdur, 0
>     amix = ar
> kwp = kwp + 1
> if kwp > ilen then
> kwp = 0
> endif
> xout amix
> endop
>
> instr 1
> asig soundin "D:/MyDocuments/csoundfiles/Old/a_voice.wav"
> ;asig in
> ifn  = 1
> iwin = 3
> kpitch = 44100 / ftlen(ifn)   ; Use original sample rate of insnd file
> kdens  = 100
> kaoff  = 0.5
> kpoff  = 5
> kgdur  = .01
> imaxgdur =  1
> icrx = 2
> aout liveGrain asig, kpitch, kdens, kaoff, kpoff, kgdur, ifn, iwin,  
> imaxgdur, ifn, icrx
> out aout
> endin
>
> 
> 
> f3  0 512  20 2;
> i1 0 100
> 
> 
>
>
> Tim Mortimer wrote:
>> Hi Rory,
>> I'd like to see yor example - or others like it involving  
>> capturing audio &
>> then using grains to pitch shift.
>> I may simply need to mod it.
>> I have a reasonably clear idea about how the GRM effect works &  
>> intend to
>> basically model it on that (it more or less uses it's audio buffer  
>> as a
>> windowed grain in its own right it seems - so if you capture a  
>> second of
>> audio & play it back at +12 you get the audio you captured played  
>> back
>> twice, with a small discontinuity assumedly where the window for  
>> recording
>> the audio ramped up & down (again to prevent discontinuities)
>> it featur
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"


Date2008-02-02 15:40
From"Dr. Richard Boulanger"
Subject[Csnd] Re: Re: Re: Re: Re: Re: distortion problem with harmon2
Steven,

This was one of our OLPC XO Demos.

Maybe we should add Barry's example to the manual?

with the appropriate generic options argument added

my arguments are -


-odac -iadc


-dB
On Feb 1, 2008, at 11:06 PM, Steven Yi wrote:

> Hi Atte,
>
> I found a copy of an example CSD that Barry Vercoe wrote for harmon2,
> harmon3, and harmon4.  Running it on XP was a bit unstable: sometimes
> I'd get crackling noise and sometimes it be perfectly clear and
> performed wonderfully.  It's as if somehow it'd get stuck calculating
> values off, then would stabilize and perform well, then get stuck
> again with crackling noise.
>
> steven
>
>
>
> On Feb 1, 2008 9:09 AM, Atte André Jensen   
> wrote:
>> Steven Yi wrote:
>>
>>> I remember trying out an example when they first got put into Csound
>>> and remember them working at the time.
>>
>> Which according to the manual was 2006...
>>
>>> I think that it'd be very bad
>>> if they were broken!
>>
>> Exactly. Right now I'm mostly interested in knowing if it's me or
>> harmon2 that's doing something wrong. Would it be inappropriate to
>> contact Barry to hear his opinion on the state of harmon2?
>>
>> --
>>
>> peace, love & harmony
>> Atte
>>
>> http://atte.dk       | http://myspace.com/attejensen
>> http://anagrammer.dk | http://modlys.dk
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
>> "unsubscribe csound"
>>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"



Date2008-02-02 23:17
From"Steven Yi"
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: distortion problem with harmon2
AttachmentsNone