[Csnd] Ring modulation one audiofile by another

Hi!

After long pause with cSound, I’m trying to remember the programming in it.

How to ring-modulate one file by another one in cSound?

Best regards,

Vadim

* Freemind <00000feca4c3aaff-dmarc-request@LISTSERV.HEANET.IE> [2024-01-29 09:19]:

Hi!

After long pause with cSound, I'm trying to remember the programming in it.

How to ring-modulate one file by another one in cSound?

Multiply their amplitudes. Ring modulation is actually amplitude
modulation.

Csound mailing list
Csound@listserv.heanet.ie

Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here

Hi Vadim,

Here’s an example (btw the correct spelling is Csound not cSound)

instr 1
p3 = min(filelen(p4), filelen(p5))
a1 diskin p4
a2 diskin p5
      out a1*a2
endin

schedule(1, 0, 0, "fox.wav", "beats.wav")

HTH

Not to seem pedantic, but ring modulation is a form of amplitude modulation but not the same.

Amplitude modulation uses a unipolar signal to modulate the carrier and the carrier remains audible (carrier + sidebands). Ring modation uses a bipolar signal to modulate the carrier and only the sidebands are audible.

-odac

sr = 48000
ksmps = 32
nchnls = 1
0dbfs = 1

instr AmpMod
aCarrier diskin “beats.wav”, 1, 0, 1
aModulator diskin “anditsall.wav”, 1, 0, 1
aSig = aCarrier * (aModulator/2 + .5)
out aSig
endin

schedule “AmpMod”, 0, 16

instr RingMod
aCarrier diskin “beats.wav”, 1, 0, 1
aModulator diskin “anditsall.wav”, 1, 0, 1
aSig = aCarrier * aModulator
out aSig
endin

schedule “RingMod”, 16, 16

Best,
Scott

Ok, that’s downright fluky - Victor & I must have posted seconds apart :slight_smile:

* ST Music <stunes6556@GMAIL.COM> [2024-01-29 10:52]:

Not to seem pedantic, but ring modulation is a form of amplitude modulation
but not the same.

Amplitude modulation uses a unipolar signal to modulate the carrier and the
carrier remains audible carrier \+ sidebands. Ring modation uses a bipolar
signal to modulate the carrier and only the sidebands are audible.

Great, I didn't know this! Thank you!
P

Csound mailing list
Csound@listserv.heanet.ie

Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here

yes, and perhaps it is most easy to consider AM as a mix of RM and the carrier signal.
so in your example:
instr AmpMod
   aCarrier diskin "beats.wav", 1, 0, 1
   aModulator diskin "anditsall.wav", 1, 0, 1
   aRM = aCarrier * aModulator
   aAM = aRM + aCarrier
   out aAM (or aAM/2)
endin
then we are free to weight like
   aAM = aRM/2 + aCarrier
or
   aAM = aRM + aCarrier/2
and we do not have to care about the modulator always staying above zero etc.

  joachim