Csound Csound-dev Csound-tekno Search About

[Csnd] The Audio Programming Book Exercise 1.5.5

Date2018-08-29 09:56
Fromfauveboy
Subject[Csnd] The Audio Programming Book Exercise 1.5.5
On page 109 of The Audio Programming Book, Exercise 1.5.5 says:

"You have decided that you want to be able to use an interval other than the
octave as the basis for the frequency calculations"

I'm not confident i know what this question is asking. So far
I'm presuming it involves the where means where the calculations are made to
work out a frequency from a MIDI note which I've copied below

The following code is taken from listing 1.5.3:

[code]

/*** find the frequency of the MIDI note ***/

/*calc standard E.T semitone ratio */
ratio = pow (2.0, 1.0 / notes);
/* find Middle C, three semitones above low A =220 */
c5 = 220.0 * pow(ratio,3);
/* MIDI note 0 is C, 5 octaves below Middle C*/
c0 = c5 * pow(0.5, 5);
frequency = c0 * pow(ratio,midinote)

[/code]

ithe question goes ont to say "add another argument to "nscale," defining
this interval (2.0 = one octave, 4.0 = two octaves, 1.5 = half an octave,
etc.), and modify the program accordingly."

I'm now guessing really that where the code reads:
[code]
ratio = pow(2.0, 1.0/ notes)
[/code]
it understand this works out a semitone within an octave. does the number
2.0 here determine the octave as a basis for the frequency calculations?

does the question mean i have to work out a semitone within two octaves and
also half an octave? And then surely thats dependent on the number of notes
that are entered by the user?

What that means is already if i enter ./nscale 24 57 the console will print
out two octaves? is this changing the interval of an octave?

I hope is appropriate I get help with this question on here i was aware that
The Audio Programming Book involves members of the forum who workwith
csound. If anyone can help me direct my thinking here that would be great,
many thanks








--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2018-09-08 19:06
FromPaul Batchelor
SubjectRe: [Csnd] The Audio Programming Book Exercise 1.5.5
To answer a few of your questions:

> does the number 2.0 here determine the octave as a basis for the frequency calculations?

Yes. What we perceive as an octave is a doubling of frequency.

> does the question mean i have to work out a semitone within two octaves and
also half an octave?

Nope. The question just wants you to add another argument to the program that can change the "2" in the equation to other values.
A semitone is only a semitone when you divide the octave into 12 equal parts.

This program allows you (and also wants you!) to explore different divisions of the octave (and other intervals).

Hope this helps,

-P





On Wed, Aug 29, 2018 at 4:56 AM fauveboy <joel.ramsbottom@hotmail.co.uk> wrote:
On page 109 of The Audio Programming Book, Exercise 1.5.5 says:

"You have decided that you want to be able to use an interval other than the
octave as the basis for the frequency calculations"

I'm not confident i know what this question is asking. So far
I'm presuming it involves the where means where the calculations are made to
work out a frequency from a MIDI note which I've copied below

The following code is taken from listing 1.5.3:

[code]

/*** find the frequency of the MIDI note ***/

/*calc standard E.T semitone ratio */
ratio = pow (2.0, 1.0 / notes);
/* find Middle C, three semitones above low A =220 */
c5 = 220.0 * pow(ratio,3);
/* MIDI note 0 is C, 5 octaves below Middle C*/
c0 = c5 * pow(0.5, 5);
frequency = c0 * pow(ratio,midinote)

[/code]

ithe question goes ont to say "add another argument to "nscale," defining
this interval (2.0 = one octave, 4.0 = two octaves, 1.5 = half an octave,
etc.), and modify the program accordingly."

I'm now guessing really that where the code reads:
[code]
ratio = pow(2.0, 1.0/ notes)
[/code]
it understand this works out a semitone within an octave. does the number
2.0 here determine the octave as a basis for the frequency calculations?

does the question mean i have to work out a semitone within two octaves and
also half an octave? And then surely thats dependent on the number of notes
that are entered by the user?

What that means is already if i enter ./nscale 24 57 the console will print
out two octaves? is this changing the interval of an octave?

I hope is appropriate I get help with this question on here i was aware that
The Audio Programming Book involves members of the forum who workwith
csound. If anyone can help me direct my thinking here that would be great,
many thanks








--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2018-09-12 09:01
Fromfauveboy
SubjectRe: [Csnd] The Audio Programming Book Exercise 1.5.5
thank you i think i understood this was the answer i used: nscale.c
  
I've attached a file called nscale.c. it takes four arguments including the
program name. tTo respond to the exercise. There's a variable called
bas4FreCal which is used to find the variable ratio. It think this explores
different divisions of the octave, intervals and a bases for calculating a
ratio?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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