Very good!
At first view, modifying "default.orc" is probably the best idea. It
would be easy to instruct BP to use cps whenever A4 is not 440 Hz.
In the same time, it would be good to have a better sound quality on the
default instrument, for instance a sawtooth waveform…
Bernard
Anthony Kozar wrote on 08/11/2020 21:16:
> Using an f-table with cpstuni is one possibility. But the pitch for
> each note would have to be passed as an integer index (e.g. MIDI note
> number). That doesn't appear to be an option in BP2 right now (?),
> although it would be easy to add.
>
> Csound 6.08 and later support changing the diapason with the A4 global
> variable. The value of A4 is used by orchestra functions like cpspch
> & cpsoct.
>
> https://csound.com/docs/manual/A4.html
>
> However, A4 must be set at the top of the orchestra similarly to sr,
> kr, etc. And I don't see any way that it can be changed by the score
> after the orchestra is initialized. It would be possible to add an
> instrument to the orchestra specifically for setting the diapason via
> a global k-rate variable. All other instruments would have to use
> that value then. For example,
>
> ; in the header section
> gkA4 = 440.0
>
> instr 1 ; set the diapason
> gkA4 = p4
> endin
>
> instr 2 ; normal instrument
> kcps = cpspch(p4) + (gkA4 - 440.0)
> ...
> kpitch = kcps * exp(kcents * ik2)
> ...
> endin
>
> ; in the Csound score
> i1 0 0 415.0 ; use Baroque pitch
> i2 ...
> i2 ...
>
> I _think_ Csound runs instruments in instrument # order so it would
> probably be best if the diapason instrument has a # less than all of
> the others.
>
> It might be best though to advise users to have BP output pitch as
> frequencies in cps/Hz when the tuning is not 440 Hz. The default
> orchestra could be modified to support both cps and octave point
> pitch-class/decimal in a reasonable way.
>
> Since an octave point pitch-class of 15.00 and an octave point decimal
> pitch value of 15.0 represent a C seven octaves above middle C having
> a frequency > 32000 Hz and there is rarely a reason to use a pitch
> lower than 15.0 Hz, the Csound instrument can interpret pitch values <
> 15.0 with cpspch() or cpsoct() and assume higher values are cps.
> Something like this should do (but I haven't tested it):
>
> if (p4 < 15.0) then
> icps = cpspch(p4)
> else
> icps = p4
> endif
>
> ...
>
> pitchbendlin: kpitch = icps * exp(kcents * ik2)
>
> Anthony
>
>
> On 11/8/20, 9:44 AM, Bernard Bel wrote:
>> Dear all,
>>
>> At the end of the documentation of -gr.Mozart
>> (https://bolprocessor.org/mozarts-musical-dice-game/) I raised the issue
>> of the diapason. By default, A4 = 440Hz both in MIDI and Csound
>> productions, the latter using the cpspch() function in the "default.orc"
>> orchestra.
>>
>> In other words, entering a different frequency of A4 on the Settings
>> page does not modify the output. Things are only different when calling
>> a Csound instrument whose pitch argument is in the "cps" format.
>>
>> All fine, but I guess there is a way of changing this 440 Hz value, and
>> it might be done by putting an appropriate "f1" line on top of the
>> score, as indicated on page http://csounds.com/manual/html/cpstuni.html
>>
>> Thus, to set the diapason to 435 Hz and an equally-tempered scale we
>> should perhaps insert:
>>
>> f1 0 64 -2 12 2 435 69 1 1.059 1.122 1.189 1.260 1.335 1.414 1.498 1.588
>> 1.682 1.782 1.888 2.000
>>
>> If this is correct, how should we instruct "default.orc" to use this
>> table for its cpspch() conversions?
>>
>> It is an exciting challenge because BP would gain in being able to
>> control more parameters of the Csound devices…
>>
>> Bernard
>>
>> PS. The "default.orc" orchestra file:
>>
>> ----------
>> ; This is a simple orchestra file for Bol Processor's default Csound
>> score output
>>
>> ; It contains one single instrument: an oscillator using wave-table 1
>> ; Argument p2 is the start date, p3 the duration (as per the standard)
>> ; Argument p4 is the pitch in octave point pitch-class format
>> ; Volume (range 0..127) is supplied by performance control _volume()
>> ; to arguments p5 (beginning value) and p6 (end value), or via the table
>> ; whose index is supplied by p7.
>> ; Pitchbend is supplied in cents to arguments p8 (beginning value)
>> ; and p9 (end value), or via the table whose index is supplied by p10.
>>
>> sr = 22050
>> kr = 2205
>> ksmps = 10
>> nchnls = 1
>>
>> instr 1
>>
>> ik1 = 32767. / 127.
>> ik2 = log(2.) / 1200.
>>
>> ifvol = p7
>> ifcents = p10
>>
>> kvol line p5, p3, p6
>> if (ifvol <= 0) goto volumelin
>> ilenvol = ftlen(ifvol)
>> kndxvol line 0, p3, ilenvol
>> kvol tablei kndxvol, ifvol
>>
>> volumelin: kcents line p8, p3, p9
>> if (ifcents <= 0) goto pitchbendlin
>> ilencents = ftlen(ifcents)
>> kndxcents line 0, p3, ilencents
>> kcents tablei kndxcents, ifcents
>>
>> pitchbendlin: kpitch = cpspch(p4) * exp(kcents * ik2)
>> kamp = kvol * ik1
>>
>> a1 oscil kamp, kpitch, 1
>> out a1 * 0.1
>> endin
>> ---------
>
>
> _______________________________________________
> bolprocessor-devel mailing list
> bol...@li...
> https://lists.sourceforge.net/lists/listinfo/bolprocessor-devel
|