ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

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

ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

Victor Lazzarini
New streaming  spectral analysis, partial tracking and
resynthesis
opcodes

This is an initial set of opcodes for streaming partial
track  spectral
processing. It includes the following opcodes:

ifd: streaming spectral analysis using the IFD
partials: partial track analysis from a  streaming PV input
tradsyn: additive synthesis of tracks (linear interpolation)
sinsyn:  additive synthesis (cubic phase)
resyn: additive synthesis (cubic phase, adapted for
transformed
signals)

A new type of streaming PV signal (fsig) has been defined
(TRACKS), which will hold partial tracks containing amp,
freq,
phase and track ID information.

Opcodes/documentation have been added to CVS. Here's the
synopsis  of the new opcodes.

IFD

Instantaneous Frequency Distribution analysis, plus
magnitude
and phase output.

ffrs, fphs ifd ain, ifftsize, ihopsize, iwintype[,iscal]

ffrs - AMP_FREQ signal
fphs - AMP_PHASE signal (unwrapped phase)

ain - input
ifftsize - fftsize (must be integer multiple of hopsize)
ihopsize - hopsize
iwintype - O:hamming; 1: hanning,
iscal - magnitude scaling (defaults to 0)

========
PARTIALS

Streaming partial track analysis

ftrk partials ffr, fphs, kthresh, kminpts, kmaxgap,
imaxtracks

ftrk - TRACKS streaming spectral signal

ffrs - AMP_FREQ input signal
fphs - AMP_PHASE input signal (unwrapped phase expected)
kthresh - analysis threshold (0 <= kthresh <= 1)
kminpts - minimum number of time-points for a partial track
kmaxgap - max gap between detected peaks in a track
imaxtracks - max number of tracks (<= number of analysis
bins)

========
TRADSYN

Streaming partial track additive synthesis

asig tradsyn  fin, kscal, kpitch, kmaxtracks, ifn

asig - output signal
fin - TRACKS streaming spectral signal
kscal - amplitude scaling
kpitch - pitch scaling
kmaxtracks - max output tracks
ifn - function table containing a sinusoid (sine or cosine)

======
SINSYN

Streaming partial track additive synthesis with cubic phase
interpolation

asig sinsyn  fin, kscal, kmaxtracks, ifn

asig - output signal
fin - TRACKS streaming spectral signal
kscal - amplitude scaling
kmaxtracks - max output tracks
ifn - function table containing a sinusoid (generally a
cosine)

======
RESYN

Streaming partial track additive synthesis with cubic phase
interpolation with pitch scaling and support for
timescale-modified
input signals.

asig sinsyn  fin, kscal, kmaxtracks, ifn

asig - output signal
fin - TRACKS streaming spectral signal
kscal - amplitude scaling
kmaxtracks - max output tracks
ifn - function table containing a sinusoid (generally a
cosine)


Author: Victor Lazzarini, 2005
--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

luis jure
el Thu, 30 Jun 2005 21:46:49 +0100
Victor Lazzarini <[hidden email]> escribi?:

> New streaming  spectral analysis, partial tracking and
> resynthesis
> opcodes

this seems to be a great set of opcodes, victor!

only one question, thought: is it a good idea to name an opcode beginning
with letter "i"?

--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

Istvan Varga
luis jure wrote:

> only one question, thought: is it a good idea to name an opcode beginning
> with letter "i"?

So, should it be renamed ? What name is suggested ?
--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

Richard Dobson
It wouldn't be the only one; there is "integ","interp" and all the in~ opcodes.

Richard Dobson



Istvan Varga wrote:

> luis jure wrote:
>
>> only one question, thought: is it a good idea to name an opcode beginning
>> with letter "i"?
>
>
> So, should it be renamed ? What name is suggested ?


--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

jpff
The idea was not to add NEW opcodes whose name started with i, k or a
(and I guess f now; does anyone use w variables?) unless the name was
compelling.  A number of opcodes were renamed, like kdump => dumpk.
==John ffitch
--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

Victor Lazzarini
In reply to this post by Istvan Varga
If it's a problem, make it:

pvsifd

Victor
At 23:20 30/06/2005, you wrote:
>luis jure wrote:
>
>>only one question, thought: is it a good idea to name an opcode beginning
>>with letter "i"?
>
>So, should it be renamed ? What name is suggested ?
>--
>Send bugs reports to this list.
>To unsubscribe, send email to [hidden email]

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth

--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

luis jure
In reply to this post by jpff
el Fri,  1 Jul 2005 06:43:27 +0100
[hidden email] escribi?:

> The idea was not to add NEW opcodes whose name started with i, k or a
> (and I guess f now; does anyone use w variables?)

and i guess we should add gi, gk and ga...


--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

David Akbari
In reply to this post by Victor Lazzarini
Hi Victor,

Typically I don't like to write the list when encountering silly
difficulties with the program. However, in this case I noticed that for
the syntax examples (listed below) the sinsyn opcode and it's args are
reiterated under the "resyn" heading. After trying out some of your new
opcodes and I noticed that the last two entries are identical and
needless to say, I got an "Incorrect number of input args" at
performance time which leads me to believe the syntax of the opcodes is
not as identical as it appears. My example .csd follows the quoted
text.

On Jun 30, 2005, at 4:46 PM, Victor Lazzarini wrote:

> ======
> SINSYN
>
> Streaming partial track additive synthesis with cubic phase
> interpolation
>
> asig sinsyn  fin, kscal, kmaxtracks, ifn   /* first instance */
>
> asig - output signal
> fin - TRACKS streaming spectral signal
> kscal - amplitude scaling
> kmaxtracks - max output tracks
> ifn - function table containing a sinusoid (generally a
> cosine)
>
> ======
> RESYN
>
> Streaming partial track additive synthesis with cubic phase
> interpolation with pitch scaling and support for
> timescale-modified
> input signals.
>
> asig sinsyn  fin, kscal, kmaxtracks, ifn     /* sinsyn or resyn? */
> asig - output signal
> fin - TRACKS streaming spectral signal
> kscal - amplitude scaling
> kmaxtracks - max output tracks
> ifn - function table containing a sinusoid (generally a
> cosine)
>
>
> Author: Victor Lazzarini, 2005
>

<CsoundSynthesizer>

<CsOptions>
-odac:0 -idevaudio:0 -d -+rtaudio=CoreAudio
</CsOptions>

<CsInstruments>
;;
sr = 44100
kr = 44100
ksmps = 1
nchnls = 2
;;
gibins init 1024
gifn1 ftgen 1,0,16384,11,1
;;
                FLpanel "sinsyn", 400,220, 400,100 /* new module test */
iv1 FLvalue  " ", 40,20,340 ,10
iv2 FLvalue  " ", 40,20,340 ,60
iv3 FLvalue  " ", 40,20,340 ,110

gk1, ih1 FLslider  "amplitude scaling",0,1,0,5,iv1,300,20,10,10
gk2, ih2 FLslider  "max output tracks",1,gibins,0,5,iv2,300,20,10,60
gk3, ih3 FLslider   "threshold",0,1,0,5,iv3,300,20,10,110
gk5, ih5 FLbutton   "mute",0,1, 2, 64, 28, 330,160,-1

FLsetVal_i 0.8, ih1
FLsetVal_i 256, ih2
FLsetVal_i 0, ih3
                FLpanelEnd
        FLrun
;;
                instr 1
; init

        strset 6969, "dl_break2.aif" /* your sample goes here */
ilen filelen 6969
kthresh = gk3
kminpts = 256
kmaxgap = .1

; synth

ain diskin2 6969,1,0,1
ffrs,fphs ifd ain, gibins, (gibins / 4), 1
ftrk partials ffrs, fphs, kthresh, kminpts, kmaxgap, gibins
a1 sinsyn ftrk, gk1, gk2, 1
a1 = a1 * (1 - gk5)

        outs a1, a1
                endin
;;
</CsInstruments>

<CsScore>
i1 0 30

e
</CsScore>

</CsoundSynthesizer>

Does the ifn parameter of tradsyn, sinsyn, and resyn point to a table
that will be used in the resynthesis - so that if it was 16
harmonically related cosines summed together to resemble the spectrum
of a sawtooth this is the waveform that would be used to resynthesize
each bin as explicitly declared in the analysis (as opposed to a
cosine)?

Is there any theoretical knowledgebase (ie. a paper) from which to draw
from to learn more about (and better understand) how to use these
opcodes and their theoretical underpinnings?


-David

--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

Istvan Varga
In reply to this post by Richard Dobson
Richard Dobson wrote:

> It wouldn't be the only one; there is "integ","interp" and all the in~
> opcodes.

Yes, but those opcodes exist for a very long time, and so instruments
are written to avoid variable names like "integ" or "ins"; on the other
hand, renaming the opcodes would result in extensive breaking of existing
orchestra code.
However, "ifd" is a new opcode that has just been added. There may very
well be instruments that use "ifd" as a variable name, while there are not
really many that use this opcode. So, renaming it is expected to break less
code than keeping the name "ifd".
--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

Victor Lazzarini
In reply to this post by David Akbari
Sorry that's my mistake (too much copying and pasting).
The right syntax is

asig resyn fin, kscal, kpitch, kmaxtracks, ifn

exactly as with tradsyn

Victor


At 12:32 01/07/2005, you wrote:

>Hi Victor,
>
>Typically I don't like to write the list when encountering silly
>difficulties with the program. However, in this case I noticed that for
>the syntax examples (listed below) the sinsyn opcode and it's args are
>reiterated under the "resyn" heading. After trying out some of your new
>opcodes and I noticed that the last two entries are identical and needless
>to say, I got an "Incorrect number of input args" at performance time
>which leads me to believe the syntax of the opcodes is not as identical as
>it appears. My example .csd follows the quoted text.
>
>On Jun 30, 2005, at 4:46 PM, Victor Lazzarini wrote:
>
>>======
>>SINSYN
>>
>>Streaming partial track additive synthesis with cubic phase
>>interpolation
>>
>>asig sinsyn  fin, kscal, kmaxtracks, ifn   /* first instance */
>>
>>asig - output signal
>>fin - TRACKS streaming spectral signal
>>kscal - amplitude scaling
>>kmaxtracks - max output tracks
>>ifn - function table containing a sinusoid (generally a
>>cosine)
>>
>>======
>>RESYN
>>
>>Streaming partial track additive synthesis with cubic phase
>>interpolation with pitch scaling and support for
>>timescale-modified
>>input signals.
>>
>>asig sinsyn  fin, kscal, kmaxtracks, ifn     /* sinsyn or resyn? */
>>asig - output signal
>>fin - TRACKS streaming spectral signal
>>kscal - amplitude scaling
>>kmaxtracks - max output tracks
>>ifn - function table containing a sinusoid (generally a
>>cosine)
>>
>>
>>Author: Victor Lazzarini, 2005
>
><CsoundSynthesizer>
>
><CsOptions>
>-odac:0 -idevaudio:0 -d -+rtaudio=CoreAudio
></CsOptions>
>
><CsInstruments>
>;;
>sr              =       44100
>kr              =       44100
>ksmps           =       1
>nchnls  =       2
>;;
>gibins init 1024
>gifn1   ftgen   1,0,16384,11,1
>;;
>                 FLpanel "sinsyn", 400,220, 400,100              /* new
> module test */
>iv1 FLvalue  " ", 40,20,340 ,10
>iv2 FLvalue  " ", 40,20,340 ,60
>iv3 FLvalue  " ", 40,20,340 ,110
>
>gk1, ih1 FLslider  "amplitude scaling",0,1,0,5,iv1,300,20,10,10
>gk2, ih2 FLslider  "max output tracks",1,gibins,0,5,iv2,300,20,10,60
>gk3, ih3 FLslider   "threshold",0,1,0,5,iv3,300,20,10,110
>gk5, ih5 FLbutton   "mute",0,1, 2, 64, 28, 330,160,-1
>
>FLsetVal_i 0.8, ih1
>FLsetVal_i 256, ih2
>FLsetVal_i 0, ih3
>                 FLpanelEnd
>         FLrun
>;;
>                 instr   1
>;       init
>
>         strset  6969, "dl_break2.aif" /* your sample goes here */
>ilen    filelen 6969
>kthresh =       gk3
>kminpts =       256
>kmaxgap =       .1
>
>;       synth
>
>ain             diskin2 6969,1,0,1
>ffrs,fphs       ifd     ain, gibins, (gibins / 4), 1
>ftrk            partials        ffrs, fphs, kthresh, kminpts, kmaxgap, gibins
>a1              sinsyn  ftrk, gk1, gk2, 1
>a1      =       a1 * (1 - gk5)
>
>         outs    a1,     a1
>                 endin
>;;
></CsInstruments>
>
><CsScore>
>i1      0       30
>
>e
></CsScore>
>
></CsoundSynthesizer>
>
>Does the ifn parameter of tradsyn, sinsyn, and resyn point to a table that
>will be used in the resynthesis - so that if it was 16 harmonically
>related cosines summed together to resemble the spectrum of a sawtooth
>this is the waveform that would be used to resynthesize each bin as
>explicitly declared in the analysis (as opposed to a cosine)?
>
>Is there any theoretical knowledgebase (ie. a paper) from which to draw
>from to learn more about (and better understand) how to use these opcodes
>and their theoretical underpinnings?
>
>
>-David
>--
>Send bugs reports to this list.
>To unsubscribe, send email to [hidden email]

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth

--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

Istvan Varga
In reply to this post by Victor Lazzarini
Victor Lazzarini wrote:

> If it's a problem, make it:
>
> pvsifd

OK, I changed the name.
--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

Victor Lazzarini
In reply to this post by David Akbari
ifn is the function table used by the bank of oscillators, so generally a
sinusoid. If you
use a complex wave, each partial will drive that waveshape. If the partials
are very high,
there might be aliasing.

In terms of info, the ideas behind opcodes are discussed in a paper in the
forthcoming
ICMC (although the implementation discussed there is found in the SndObj
lib). I can send it
to you if you wish.

In the manual I give some simple examples of use:

ain inch 1
ffr, fphs  ifd  ain, 2048, 256, 1
ftrk  partials  ffr, fphs, 0.003, 1, 3, 500
aout  tradsyn  ftrk, 1, 1.5, 500, 1

tradsyn is the less intensive resynthesis opcode, the others are not
guaranteed to
run in realtime. This also depends on the input sound. A simpler sound will
yield
less tracks and thus be faster in resynthesis.

One thing that is missing from the set is the analysis file reading opcode
(and the
associated utility), so that time-stretching can be made possible. This
will be added
as I get free time to work on it. Also other opcodes for morphing,
filtering, etc..

Some sort of non-linear filtering can be achieved by using less tracks in
resynthesis and
other effects by changing mintracks and maxgap

Victor

At 12:32 01/07/2005, you wrote:
>Does the ifn parameter of tradsyn, sinsyn, and resyn point to a table that
>will be used in the resynthesis - so that if it was 16 harmonically
>related cosines summed together to resemble the spectrum of a sawtooth
>this is the waveform that would be used to resynthesize each bin as
>explicitly declared in the analysis (as opposed to a cosine)?
>
>Is there any theoretical knowledgebase (ie. a paper) from which to draw
>from to learn more about (and better understand) how to use these opcodes
>and their theoretical underpinnings?

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth

--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ANN: New streaming spectral analysis, partial tracking and resynthesis opcodes

Richard Dobson
In reply to this post by Istvan Varga
OK, understood.

Richard Dobson


Istvan Varga wrote:

> Richard Dobson wrote:
>
>> It wouldn't be the only one; there is "integ","interp" and all the in~
>> opcodes.
>
>
> Yes, but those opcodes exist for a very long time, and so instruments
> are written to avoid variable names like "integ" or "ins"; on the other
> hand, renaming the opcodes would result in extensive breaking of existing
> orchestra code.
> However, "ifd" is a new opcode that has just been added. There may very
> well be instruments that use "ifd" as a variable name, while there are not
> really many that use this opcode. So, renaming it is expected to break less
> code than keeping the name "ifd".


--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]