Open dbadb opened 1 year ago
yep, it seems the guitar sample is playing at c4 when typing c3... i can do some further digging tomorrow
I recorded those three samples as guitar middle C. In ableton live it's MIDI C2 (48). If you find interesting to add that to their file names, I can PR.
Let me bring order to my mind and this issue. These are the different concepts / units at play:
1-4 are clearly defined in in scientific pitch notation / international pitch notation (IPN) (https://en.wikipedia.org/wiki/Scientific_pitch_notation)
This mapping can be checked in strudel with
note("a4")
= freq(440)
= note(69)
note("c4")
= freq(261)
= note(60)
note("c3")
= freq(130)
= note(48)
not specifying a s
will fall back to a triangle oscillator.
the pitch of that oscillator is detected correctly in ableton tuner + c4 matches middle c on the piano
So, as suspected, the problem has to do with sample pitch mapping..
Ableton Tuner detects the gtr
sample gtr/0001_cleanC.wav
as 130Hz = C3 = midi 36
When explicitly declaring that pitch of the sample:
samples(
{ gtr: { c3: 'gtr/0001_cleanC.wav' } },
'github:tidalcycles/Dirt-Samples/master/'
);
note("c3").s("gtr");
.. it works, as it plays back normally (without repitch). The actual issue occurs only when no pitch is declared:
samples(
{ gtr: 'gtr/0001_cleanC.wav' },
'github:tidalcycles/Dirt-Samples/master/'
);
note("c2").s("gtr");
this will play the sample as is without repitching.. so basically the default pitch is c2
.
The sentence If a sample has no pitch set, c3 is the default.
is an error in the docs.
I'd say let's change that default pitch to use c3 or even c4 (middle c).
Let's now look at how tidal does things:
d1 $ s "gtr"
plays the sample as is (obviously)d1 $ note "c5" # s "gtr"
also plays the sample as is (c3 in IPN)d1 $ note "c5" # s "supersaw"
plays middle c (c4 in IPN)d1 $ note "0" # s "supersaw"
plays middle c (c4 in IPN)d1 $ note "a5" # s "supersaw"
plays a4 IPN (440Hz)d1 $ freq "440" # s "supersaw"
plays a4 IPN (440Hz)Things to note:
gtr
is a sample (in c3 IPN) while "supersaw" is a synth to help compare the sample togtr
is one octave lower than a synth, as it is in c3 IPN
My opinion:
The default sample pitch should be c3 or c4 (instead of c2 as it is now)
I am against deviating from the a4 = 440Hz standard
Anchoring note numbers at 0 seems helpful
midin("60")
I think it is confusing that n
acts as note for synths, while it acts as a sample number for sample banks:
d1 $ n "0 2 4" # s "supersaw"
= d1 $ note "0 2 4" # s "supersaw"
d1 $ n "0 2 4" # s "gtr"
!= d1 $ note "0 2 4" # s "gtr"
same for strudel
n("60 62 64").s('triangle')
= note("60 62 64").s('triangle')
n("60 62 64").s('piano')
!= note("60 62 64").s('piano')
This confusion could be resolved by not allowing n to control synth pitch..
The docs should also be enhanced at https://strudel.tidalcycles.org/learn/notes/ where n
is explained as the general solution for numeral pitch (which it is not for samples + it is not explained that you can use numbers with note
as well)
Hi Felix - I think all of this sounds great. I wasn't aware of the Scientific pitch notation (SPN) and had been relying on other resources to convert note names like C4 to MIDI note numbers. here and here are two discussions of this.
While the second source claims that the C3 convention is the more common, the fact that it's not a reliable standard is a real problem. The Ableton thread implies that they've adopted C3 too. Sadly this lack of standard will likely be the cause of many misunderstandings. The post above from @pd3v supports the idea that Ableton is on the C3 convention. The good news is that MIDI note 60 is unequivocally middle-C, so I'm a bit confused by pd3v's statement that he recorded it on guitar middle C and then describes it as note 48 (C2). Certainly C2 is note 48 in the C3 convention but it's not middle C. Just an example of the confusions to come.
Since both the SPN and Tonal have settled on the C4 convention I agree that it's the right one.
On your other points:
making the default base-pitch for samples be C3 or C4.
I infer that the original design intent was that C3 was middle-c which is as good a convention for a default base-pitch as any. Now that we're clear that Strudel is operating with the C4 convention, perhaps making C4 the default base-pitch would be advised. This would require some updates to docs. And apparently require that the C3 base-pitch (MIDI 48) be provided in the gtr
example.
on the confusion of n and note I was also confused by this but imagine there's some legacy/compatibility with super-dirt at issue here. If you are collecting opinions, I would be fine with note only accepting "C4" and "60" and now the value "0" would be unambiguously interpreted as literal MIDI note 0 aka: C-1 in the C4 convention. Small integral values are useful as indices in a scale so there's likely to be a message-passing subtlety in the transformation of scale index to note number.
As an aside:
I've been working on integrating Strudel-over-OSC with Fiddle and ChucK... Things are going quite well. Strudel is cool!
Hey! @dbadb, I guess "guitar middle C" is guitar's lowest C (48). Just "middle c" (60) has to do with concert pitch; it is the C (60) in the octave of concert pitch A (69).
@pd3v - indeed the middle in middle c on a guitar appears ill-defined in common parlance. That said this link shows how to find the middle-c frequency on a guitar fretboard in a standard tuning. More of a FWIW than a useful piece of information, I imagine. The important point is that the guitar is a transposing instrument, so on a treble stave the middle-C is really a request for one octave lower (ie 48, C3 in the C4 system). So it "looks" like a middle-c on the treble clef when notated for guitar. (I wasn't aware of this until now, lol)
just did another experiment, and somehow tidal is now using c5 as the default sample pitch:
d1 $ s "jvbass" # note "c5"
=== d1 $ s "jvbass"
so either it changed, or I was drunk when I "found out" it's c4
btw I was kind of reluctant to touch this issue, because it will break / repitch every single pattern that uses pitched samples ... not sure if it now just is what it is or if there should be just a big breaking change at some point
Middle C = C4 = 261.626 Hz = sampler speed of 1 might make the most sense because that is what middle C is on the piano and the piano is the closest thing the world has to a standard expectation
Reading through Tidal docs, the default base-pitch of a sample is C3 which is also supposed to be middle C (note 60). It appears to me that the Tonal package operates with C4 as 60 and this means that some things are off by one octave.
In the case of the base-pitch example here, the unspecified base-pitch for gtr produces a different result than when specified as 'c3'. My reading of the docs suggests that this is a bug.
If Strudel adopts/adheres-to the C3 convention (which is the more common one imho), then one would need to uniformly add 12 to all note-numbers coming out of Tonal. Perhaps ideally the convention could be a configuration option for Tonal. A quick glance at the webaudio/sampler code shows calls to core/utils.js:toMidi which appears to produce octaves starting at 1. The sampler code corrects for this by subtracting 36 (3 octaves) which seems about right I think.