Simple Synth pitches #203
-
Hi. My apologies if I've posted this in the wrong place. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 8 replies
-
Good catch! Maybe an off-by-one error with the index ? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply! It's been like this since day one. I've finally just
decided to ask if there is a reason. I'm assuming that that pitches.h has
the wrong values? It's just that if you try to use it in conjunction with
other synthesizers, it's a half step down. I tried to edit pitches.h but I
don't quite understand the logic behind the numbers. They don't match the
standard midi note number chart as seen below.
[image: image.png]
|
Beta Was this translation helpful? Give feedback.
-
Ah gotcha! Those in pitches.h are the actual frequencies and not midi #s.
No wonder as I was editing pitches.h, things were getting microtonal 😂. I
have to say, out of all the synth sketches available, I still find the
noiseless sound and ample volume of the 'Simple Synth' sketch the best out
there. I wish everyone would use it as a baseline on how to produce a
perfect square wave 💓.
Thanks again!
…On Mon, Feb 22, 2021 at 2:31 AM François Best ***@***.***> wrote:
According to the tone documentation
<https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/>,
those numbers are frequencies in Hertz, rounded to the nearest integers.
Indeed, they don't seem to match:
https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/
I'll create an issue, thanks for the report !
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#203 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AED7FLLDILZ5TEY4RZ5C3NLTAIB6DANCNFSM4X72USPQ>
.
|
Beta Was this translation helpful? Give feedback.
-
Nice!
I actually have a Juno-6... I love it dearly. I bought it 30 years ago for
$50 when nobody cared lol. I added MIDI to it a few years ago, a much
needed mod.
Thanks man!
…On Mon, Feb 22, 2021 at 4:54 AM François Best ***@***.***> wrote:
Thanks for the kind words!
For more synth goodness, check out another library/project of mine: PCO,
which (with a lot of work) can transform an AVR chip into a fully fledged
digital oscillator (with modulation):
https://github.com/FortySevenEffects/pco
It uses timers to divide the chip's clock into pitch-accurate square
waves, like the Juno DCOs did.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#203 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AED7FLJCTNHYJZZ5MWQFNJ3TAISVDANCNFSM4X72USPQ>
.
|
Beta Was this translation helpful? Give feedback.
-
The problem was not quite an off-by-one error. It was off-by-23, which happens to be off-by-one-and-two-octaves, which explains the off by a step. |
Beta Was this translation helpful? Give feedback.
-
Oh ok. I'm very happy it's going to be corrected! Honestly, I'm actually
surprised this issue hasn't been brought up before after all these years. I
guess most people just hook it up to a midi controller and not use it as an
additional instrument. The only other thing I think the sketch needs as a
standard feature is the implementation of 'pitch bend'. I've been using the
Mozzi library for anything that I don't make in the analog domain but, I
still think the way the square wave in the Simple Synth sketch sounds the
best. I'm guessing it's because it uses the 'tone' library. I convert the
Square wave into a Sawtooth wave with an integrator that I make using an
opamp and I'm able to run both waves simultaneously.
Thanks again man!
…On Tue, Feb 23, 2021 at 4:48 AM François Best ***@***.***> wrote:
The problem was not quite an off-by-one error. It was off-by-23, which
happens to be off-by-one-and-two-octaves, which explains the off by a step.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#203 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AED7FLKX2UGB2UXYPSAR36DTAN2VZANCNFSM4X72USPQ>
.
|
Beta Was this translation helpful? Give feedback.
-
Here's the 'Integrator' Square wave to Sawtooth wave circuit I use. Any
single op-amp should work, however I prefer 'Rail To Rail' amps like the
OP07. The diodes I've used are 1N914 or 1N4148. The Trim pot I used was 50K
OHM. I encourage you to experiment and try alternative components and
values.
![Square2Saw](https://user-images.githubusercontent.com/17298093/109336508-7b29ce00-7831-11eb-97cc-187e9ae2c9ec.jpg)
|
Beta Was this translation helpful? Give feedback.
-
Unfortunately, I'm just a hardware guy. I don't have what it takes for
creating the code itself. I can do a bit of editing at best. I just end up
looking at the code I'm trying to achieve from other sketches. Most of the
time it doesn't work but every once in a while, I get lucky lol. But it
would be awesome if Pitch Bend could be implemented in the Simple Synth
sketch!
…On Fri, Feb 26, 2021 at 12:18 PM nonsuchpro ***@***.***> wrote:
Here's the 'Integrator' Square wave to Sawtooth wave circuit I use. Any
single op-amp should work, however I prefer 'Rail To Rail' amps like the
OP07. The diodes I've used are 1N914 or 1N4148. The Trim pot I used was 50K
OHM. I encourage you to experiment and try alternative components and
values.
On Tue, Feb 23, 2021 at 12:55 PM François Best ***@***.***>
wrote:
> Math check:
>
> If we consider the following variables:
>
> - P the pitch bend value, between [-1;0;+1]
> - R the pitch bend range in semitones (by how much the note is bent
> at full bend)
> - N the base note
>
> const float baseFreq = 440.f * powf(2.f, (N - 69.f) / 12.f);const float bentFreq = 440.f * powf(2.f, (N + P * R - 69.f) / 12.f);const float bendFactor = powf(2.f, P * R / 12.f);
> const int finalFreq = round(bendFactor * baseFreq);
>
> We can get the base frequency from the lookup table, and apply the bend
> factor before rounding again to the nearest Hertz. This would introduce a
> quantisation error of 1/2 Hertz due to using the pre-rounded base
> frequency, but I don't think it would be audible.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#203 (reply in thread)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AED7FLKRTZYKTGBEK7QV3UDTAPTZHANCNFSM4X72USPQ>
> .
>
|
Beta Was this translation helpful? Give feedback.
-
@franky47 |
Beta Was this translation helpful? Give feedback.
The problem was not quite an off-by-one error. It was off-by-23, which happens to be off-by-one-and-two-octaves, which explains the off by a step.