Csound Csound-dev Csound-tekno Search About

Re: [Csnd] How to implemement octave divider?

Date2020-01-30 09:33
FromMikoláš Štrajt
SubjectRe: [Csnd] How to implemement octave divider?


For anyone not familiar with the concept, an "octave diviider"
is the sort of circuit that was typically used in the old electronic
organs. It was an oscillator -- normally square-wave -- in which
a cycle was triggered by the waveform edge of a previous
oscillator, but only by every *second* edge. It therefore
oscillates at exactly half the frequency of its driver.


it was used (mainly) because frequency divider was cheaper that another oscillator. Sub oscillator or organ harmonics was implemented this way.

 

I can't think of any way to do that in Csound, though. Maybe
someone else has a bright idea?

One of the significant features of a divider scheme, however
is that the phases of all the octaves are locked together,
which makes the result of mixing octaves consistent. (No
destructive interference.)


This is why I am looking for it.

 

I had a similar concern in the Hammond simulator I wrote,
because a tone wheel may connect to several notes to provide
its harmonics. As in Csound it is much easier to have a separate
oscillator for each harmonic of each note, it was necessary to
synchronize these separate instances. I did this by setting the
phase of each oscillator according to exactly when it is started.


this looks exactly like something I am looking for.


How did you implemented that sync? Could you provided more hints (opcode names) or example code?


I found some example of hadsync using syncphasor - see https://github.com/rorywalsh/cabbage/blob/master/Examples/Instruments/Synths/HardSyncSynth.csd


Is this something similar to what you used?

 

Maybe something like that would suffice here?

-- Pete--


On Wed, Jan 29, 2020 at 10:17:28PM +0000, Johann Philippe wrote:
> Hello Mikoláš, 
> I'm not sure what you mean exactly by octave divider ? And I guess that by oldschool way you mean to implement it yourself ?
> BestsJohann  Le mercredi 29 janvier 2020 à 13:19:52 UTC+1, Mikoláš Štrajt <strajt9@seznam.cz> a écrit :
>
> Hi,
> I would like to create String synthetiser with Csound.
>
> I wanna sound as analog as possible, so I want to create sounds with octave divider but I have no idea how to implement it.
>
> I am pretty sure that there is a opcode for that but I cannot figure which.
>
> (I understand, that I can simply use another oscillator/VCO with cpsmidinn(inotnum-12) but I want go oldschool way).
> --
> Severákhttp://tilde.town/~severak/
>
> Csound mailing listCsound@listserv.heanet.iehttps://listserv.heanet.ie/cgi-bin/wa?A0=CSOUNDSend bugs reports to https://github.com/csound/csound/issuesDiscussions of bugs and features can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
> https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-01-30 12:07
From00000008a49663bc-dmarc-request@LISTSERV.HEANET.IE
SubjectRe: [Csnd] How to implemement octave divider?
To fake octave fuzz pedals method I use abs opcode and dcblock (a crude full wave rectifier), works with guitar, maybe can be useful.
Bye

Stefano



Date2020-01-30 19:27
FromPete Goodeve
SubjectRe: [Csnd] How to implemement octave divider?
AttachmentsNone  

Date2020-01-30 20:04
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] How to implemement octave divider?
My approach implementing tonewheels was to have all 96 tone wheels as constant running oscs synced to each other and when a note was played, it just tapped whatever tonewheels it required according to freq and drawbars.

Prof. Victor Lazzarini
Maynooth University
Ireland

> On 30 Jan 2020, at 19:28, Pete Goodeve  wrote:
> 
> *Warning*
> 
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> 
>> On Thu, Jan 30, 2020 at 10:33:01AM +0100, Mikoláš Štrajt wrote:
>> 
>> Od: Pete Goodeve 
>> 
>> "I had a similar concern in the Hammond simulator I wrote,
>> because a tone wheel may connect to several notes to provide
>> its harmonics. As in Csound it is much easier to have a separate
>> oscillator for each harmonic of each note, it was necessary to
>> synchronize these separate instances. I did this by setting the
>> phase of each oscillator according to exactly when it is started.
>> "
>> 
>> this looks exactly like something I am looking for.
>> 
>> How did you implemented that sync? Could you provided more hints (opcode
>> names) or example code?
> 
> The problem is that it's rather buried in a mess of all the twiddles
> needed to try to emulate the Hammond. (:-/)  I'll try to extract the
> idea with segments of the code:
> 
> ;------------------------------------------------------------------------
> ; Phase Management
> ; we use performance time and frequency to set the initial phase of
> ; each harmonic.
> ; This should both keep multiple uses of the same 'wheel' in sync
> 
> iT times        ;get the absolute time the note started
> 
> ;Check how many notes are active (there are two 'Manual' instruments):
> giActiveS active "ManualS"
> giActiveG active "ManualG"
> ; If this is the only note, get a 'base seconds' to restart things:
> if (giActiveS + giActiveG) == 1 then
>        giBaseTime = int(iT)
> endif
> 
> iT = iT - giBaseTime    ; keep ref time short fort computation accuracy
> 
> ....
> 
> ;Just one of the 9 'tone-wheel oscillators:
> afund    oscil  kfund*isf,    iff,   iwheel2, frac(iT*iff)
> 
> ;Don't worry too much about the various parameters. The amplitude
> ;is from drawbar position and an (unused) scale factor); the frequency
> ;is from a table of exact Hammond tones, and the waveform is an
> ;'almost-sime-wave'.  The importan t bit here is "frac(iT*iff)" which
> ;determines the exact phase at which the oscillator should start.
> 
> --------------------------------------------------------------
> 
> Hope that makes some sort of sense.  If you want way more detail (!),
> I have a web page on it at http://GoodeveCA.net/RotorOrgan.  There
> is a downloadable archive of the complete csd at the bottom of the
> page.
>> 
>> 
>> I found some example of hadsync using syncphasor - see https://github.com/ rorywalsh/cabbage/blob/master/Examples/Instruments/Synths/HardSyncSynth.csd
>> 
>> Is this something similar to what you used?
>> 
> Never knew about that opcode.  Looks like a rather different approach.
> 
>        -- Pete --
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-01-30 20:30
FromPete Goodeve
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] How to implemement octave divider?
AttachmentsNone  

Date2020-01-30 21:03
Frommskala@ANSUZ.SOOKE.BC.CA
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] How to implemement octave divider?
On Thu, 30 Jan 2020, Pete Goodeve wrote:
> On Thu, Jan 30, 2020 at 08:04:53PM +0000, Victor Lazzarini wrote:
> > My approach implementing tonewheels was to have all 96 tone wheels as constant running oscs synced to each other and when a note was played, it just tapped whatever tonewheels it required according to freq and drawbars.
> >
> I was worried that running 91 oscillators continuously would be
> a heavy load (my machine was quite a bit slower back then!)
> Might be a simpler approach now.

In the actual organ, the tonewheels are all on the same shaft, right?  So
I wonder if it would make sense to just have one global oscillator
representing the position of the shaft, and feed it through one lookup
table per tonewheel, doing the lookup only for the tonewheels you're
actually using.

-- 
Matthew Skala
mskala@ansuz.sooke.bc.ca                 People before tribes.
https://ansuz.sooke.bc.ca/

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-01-30 21:17
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] How to implemement octave divider?
yep, something like that is what I have used I think. If not, that’s the right approach,
1 phasor at the lowest freq and then table readers scaling these by the correct amounts.
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 30 Jan 2020, at 21:03, mskala@ansuz.sooke.bc.ca wrote:
> 
> On Thu, 30 Jan 2020, Pete Goodeve wrote:
>> On Thu, Jan 30, 2020 at 08:04:53PM +0000, Victor Lazzarini wrote:
>>> My approach implementing tonewheels was to have all 96 tone wheels as constant running oscs synced to each other and when a note was played, it just tapped whatever tonewheels it required according to freq and drawbars.
>>> 
>> I was worried that running 91 oscillators continuously would be
>> a heavy load (my machine was quite a bit slower back then!)
>> Might be a simpler approach now.
> 
> In the actual organ, the tonewheels are all on the same shaft, right?  So
> I wonder if it would make sense to just have one global oscillator
> representing the position of the shaft, and feed it through one lookup
> table per tonewheel, doing the lookup only for the tonewheels you're
> actually using.
> 
> -- 
> Matthew Skala
> mskala@ansuz.sooke.bc.ca                 People before tribes.
> https://ansuz.sooke.bc.ca/
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-01-30 21:18
FromJana Hübenthal
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] How to implemement octave divider?
That approach sounds exactly right!

Am 30.01.20 um 22:03 schrieb mskala@ANSUZ.SOOKE.BC.CA:
> On Thu, 30 Jan 2020, Pete Goodeve wrote:
>> On Thu, Jan 30, 2020 at 08:04:53PM +0000, Victor Lazzarini wrote:
>>> My approach implementing tonewheels was to have all 96 tone wheels as constant running oscs synced to each other and when a note was played, it just tapped whatever tonewheels it required according to freq and drawbars.
>>>
>> I was worried that running 91 oscillators continuously would be
>> a heavy load (my machine was quite a bit slower back then!)
>> Might be a simpler approach now.
> In the actual organ, the tonewheels are all on the same shaft, right?  So
> I wonder if it would make sense to just have one global oscillator
> representing the position of the shaft, and feed it through one lookup
> table per tonewheel, doing the lookup only for the tonewheels you're
> actually using.
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-01-30 21:20
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] How to implemement octave divider?
I know someone who used a similar approach to do a tonewheel in an arduino (but not the base model, a better one),
and he managed to fit all oscillators within the compute budget. I think modern computers should be able to handle
90 odd oscillators in Csound with no problems, but have not tested it widely ;)
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 30 Jan 2020, at 20:30, Pete Goodeve  wrote:
> 
> On Thu, Jan 30, 2020 at 08:04:53PM +0000, Victor Lazzarini wrote:
>> My approach implementing tonewheels was to have all 96 tone wheels as constant running oscs synced to each other and when a note was played, it just tapped whatever tonewheels it required according to freq and drawbars.
>> 
> I was worried that running 91 oscillators continuously would be
> a heavy load (my machine was quite a bit slower back then!)
> Might be a simpler approach now.
> 
> 	-- Pete --
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-01-30 21:30
FromPete Goodeve
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] How to implemement octave divider?
AttachmentsNone  

Date2020-01-30 21:46
Frommskala@ANSUZ.SOOKE.BC.CA
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] How to implemement octave divider?
On Thu, 30 Jan 2020, Pete Goodeve wrote:
> > > In the actual organ, the tonewheels are all on the same shaft, right?  So
> > > I wonder if it would make sense to just have one global oscillator

> I'm not sure that's actually possible!  The wheels may all be driven
> by the same motor, but they're not on the same shaft,  There are

It could still be done with one oscillator per gear ratio - there still
are fewer of them than there are tonewheels - or by making the master
oscillator really slow.  But that does make things more complicated.

-- 
Matthew Skala
mskala@ansuz.sooke.bc.ca                 People before tribes.
https://ansuz.sooke.bc.ca/

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-01-30 21:55
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] How to implemement octave divider?
It can be done alright. A phasor at a low frequency, and then each table lookup is
scaled to the correct frequency. Everything is locked in phase then.

Prof. Victor Lazzarini
Maynooth University
Ireland

> On 30 Jan 2020, at 21:46, mskala@ANSUZ.SOOKE.BC.CA  wrote:
> 
> On Thu, 30 Jan 2020, Pete Goodeve wrote:
>>>> In the actual organ, the tonewheels are all on the same shaft, right?  So
>>>> I wonder if it would make sense to just have one global oscillator
> 
>> I'm not sure that's actually possible!  The wheels may all be driven
>> by the same motor, but they're not on the same shaft,  There are
> 
> It could still be done with one oscillator per gear ratio - there still
> are fewer of them than there are tonewheels - or by making the master
> oscillator really slow.  But that does make things more complicated.
> 
> -- 
> Matthew Skala
> mskala@ansuz.sooke.bc.ca                 People before tribes.
> https://ansuz.sooke.bc.ca/
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-01-30 22:23
FromPete Goodeve
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] How to implemement octave divider?
AttachmentsNone  

Date2020-01-30 22:28
FromPete Goodeve
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] How to implemement octave divider?
AttachmentsNone  

Date2020-01-31 07:48
FromPete Goodeve
SubjectRe: [Csnd] How to implemement octave divider?
AttachmentsNone  

Date2020-01-31 10:06
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] How to implemement octave divider?
Maybe I wasn’t speaking clearly, 12 phasors at the fundamentals 

a1 phasor ifr
as tablei a1*iscale,-1,1,0,1

iscale being the harmonic associated with a drawbar.

best
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 31 Jan 2020, at 07:48, Pete Goodeve  wrote:
> 
> *Warning*
> 
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> 
> On Thu, Jan 30, 2020 at 02:28:28PM -0800, Pete Goodeve wrote:
>> On Thu, Jan 30, 2020 at 09:55:41PM +0000, Victor Lazzarini wrote:
>>> It can be done alright. A phasor at a low frequency, and then each table lookup is
>>> scaled to the correct frequency. Everything is locked in phase then.
>>> 
>> 
>> Sorry?  I'm really missing something here.  How do you "scale a frequency"
>> arbitraily from a low frequency source?  Do you have an example?
>> 
> 
> OK -- I guess I can see that if one could find a very low frequency
> whose period fitted an integral number of periods of each of the
> tonewheels you could do this.  However, playing with numbers, I
> can't find any such frequency (unless maybe with a period of
> several centuries!)
> 
> There is a compromise, though.  If you have  phasor for each
> note of the (lowest) octave, each octave above just needs a sweep
> frequency multiplied by the number of teeth in the wheel.  At first
> glance this looks like it might be quite good.
> 
> I guess this would work for Mikoláš' needs as well.  Instead of
> dividing down, it would just multiply up.  Same effect.
> 
>        -- Pete --
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-01-31 19:04
FromPete Goodeve
SubjectRe: [Csnd] [EXTERNAL] [Csnd] How to implemement octave divider?
AttachmentsNone