Csound Csound-dev Csound-tekno Search About

Re: +/- 90 degree phase shift of input WAV?

Date2007-08-01 17:16
FromIain McCurdy
SubjectRe: +/- 90 degree phase shift of input WAV?
Following on from Victor's suggestion of using the filelen opcode, the following code will allow you to process files whereby the duration of the output file will be defined by the duration of the input file.
Iain
 
<CsoundSynthesizer>
 
<CsOptions>
-oprocessed.wav
</CsOptions>
 
<CsInstruments>
sr   =  44100
kr   =  4410
ksmps   =  10
nchnls   =  1

  instr  1
;DERIVE DURATION OF INPUT FILE
ilen  filelen "input.wav"
;'PLAY' INSTRUMENT 2 FOR DURATION=ilen
  event_i "i", 2, 0, ilen
  endin  
 
  instr 2
;CREATE AN AUDIO SIGNAL
asig  diskin "input.wav", 1
;SOME PROCESSING OF asig IN HERE PERHAPS
;asig SENT TO OUTPUT (IN THIS CASE OUTPUT WAV)
  out asig
  endin

</CsInstruments>
 
<CsScore>
;NOTE DURATION IRRELEVANT HERE. DURATION IS DICTATED BY event_i OPCODE
i 1 0 .001
</CsScore>
 
</CsoundSynthesizer>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


> Date: Wed, 1 Aug 2007 07:20:30 -0700
> From: rhester@multics.dynalias.com
> To: csound@lists.bath.ac.uk
> Subject: Re: [Csnd] +/- 90 degree phase shift of input WAV?
>
>
> Victor Lazzarini wrote:
> >
> > what you are doing appears at a quick glance to
> > be SSB, rather than a straight phase shift.
> >
> > The hilbert output will exhibit two signals which
> > are 90-degree apart, so you just use them directly.
>
> Understood.
>
> So far, I sort of get what Csound is doing - it's basically applying a sine
> (or cosine) wave to the WAV input to cause the 90-degree shift (thus doing a
> Hilbert transform). The challenge that I have is understanding the concept
> of an instrument and score - since my intention is to simply apply the
> transform to the entire duration of the input WAV, the duration of the input
> is not necessarily known - so the duration parameter to linseg isn't known
> (unless Csound has some way to derive it).
>
> I am sure the solution must be reasonably simple, since Csound is advertised
> as a tool well-suited to doing DSP on input files, but I can find few (well,
> in truth, no) examples of how to do simple file-based input post-processing
> (as opposed to the more traditional output synthesis method) with Csound.
>
> Rodney
> --
> View this message in context: http://www.nabble.com/%2B---90-degree-phase-shift-of-input-WAV--tf4197587.html#a11946344
> Sent from the Csound - General mailing list archive at Nabble.com.
>
> --
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk



Missed the show?  Watch videos of the Live Earth Concert on MSN. See them now!