The first concern is with the comment parsing, at the moment its very brittle, in that any minor changes in the source file can cause it to break.
A comment is basically any line with a ; at the start, but it might contain non alphanumeric chars, such as .
Im sure there must be a better way than my current set of sequence rules. <alphaNum*> <.*> <alphaNum*>
I've tried to make a rule that says something like
; <alphaNum*> <newline> but that doesnt work.
My second problem is once i have the note -> frequency mapping contained in an array, how can i use it?
The midi->poly converter outputs a 'pitch' value but this is a stream and my array is all green data.
So, is there a way in which i can get the midi note number, use that as the index to lookup in the array and use the resulting float value to control the frequency of an oscillator?
Any ideas or suggestions for either problem would be gratefully received..
infuzion ·
mdk wrote: My second problem is once i have the note -> frequency mapping contained in an array, how can i use it?
Not sure what you mean... can you provide an example that will allow us to play an OSC, or do you need help with that?
cheers
mdk ·
let me describe things a bit more clearly.
After parsing the tuning file I have a Float Array which maps MIDI note numbers to frequencies in Hz.
What i have been trying is using the MIDI Split, I can get the note number, this is then used as the index into the Float Array Get At module, the output of is the frequency in Hz for that note, but its a green float signal.
I've not yet found a way to use this Hz value to control the frequency of say the sine oscillator.
a picture might help :
so this obviously doesnt work and im not quite sure how to make it work. I realise there is some magic that happens when you have a complete stream from midi in to mono out, but is there any way now to get it working.
any help would be great..
thanks. 🙂
jorge ·
Hi mdk
What you need to do is somehow connect the MidiToPoly to the white poly section. Because you dont need to affect it, you can just multiply any of the outputs of the MidiToPoly by zero ( leave the second input of the multiplier not connected ) and connect somewhere to the white section to the right.
Here's an example:
[old link]
mdk ·
cool..
the stupid thing is i already tried something like that and somehow it didnt work, now i did it again following your example..and it works..
now i can debug the file parser 🙂
thanks.
jorge ·
actually, I think it wont work properly, all notes will play the same frequency. The white section of the schematic represents poly sound and the frequency on the green component is used for all notes playing.
What you might need is a new component or event a FloatArray input to the MidiToPoly that accepts a table of 128 frequencies, one for each MidiNote. It would be very easy to implement.
Another way would be to write your table to a Mem component and use the MemRead component to access it using pitch to index it, I think that might be a better more flexible way.
stefan ·
Or write it into a graph and use graph to poly to read from it (with pitch for indexing)
jorge ·
stefan wrote: Or write it into a graph and use graph to poly to read from it (with pitch for indexing)
I thought that too, I was going to try it first in a schematic. I agree it's the best way at the moment.
Graph and FloatArray are suposed to be the same and will eventually converge and have the same connector symbol. Most component have been changed to support connecting a FloatArray to a Graph and vice-versa but not all of them.
mdk ·
right, thanks for the suggestions...
to make it more interesting i've realised that the .tun files dont contain a note number to frequency map, its actually a mapping of note numbers to fractional note numbers e.g.
but for some reason the right hand side is multiplied by 100.
so i thought about using the midi event module to create a new event from the mapping but obviously midi only supports integer note numbers.
So if anyone has any bright ideas about how to use fractional note numbers im all ears.
One idea I have is to get the input note number and the mapped note number then find out the difference. Then use that difference to control the pitchbend amount to get the right frequency.
Also while im here, what range of values does the 'pitch' output of the midi->poly module use?
sambean ·
So if anyone has any bright ideas about how to use fractional note numbers im all ears.
How about dividing the number by 100, then using the pitch to frequency module?
so for 13 = 1271
divide by 100 = 12.71
which using the p to f gives me a frequency of 0.000754531
so multiplying by SR gives 34.0723 Hz
Would this work?
Sam
stefan ·
Pitch is iirc equal to note number. Which is great for you, because all you have to do then is use pitch as an index and use the value in your table as the new pitch, if you divide it by 100 that is 🙂
midi to poly pitch->graph to poly->multiply with 0.01->use as new pitch
mdk ·
right, well that sounds good but im a bit confused as to whats going on with the different frequency ranges (Hz / 0->1) and how im converting pitch to frequency.
:EDIT: So, at the moment im getting a really low frequency from the oscillator... :EDIT:
i can feel im really close but i just need to close the last gaps in my SM knowledge.
btw, i put the pitch index * 0.01 inside the parsing code so the pitch values should be correct coming out of the graph.
thanks again everyone for the help....hopefully soon i'll have a nice little module to share that makes it easy to add alternative tuning support to any SM creations.
😀
sambean ·
I can't seem to get anything out of the 'p to f' stream module, there may be a bug..
Try connecting it to an analyser then to a graph to float to read the value.. all I can get out is '1.#INF' regardless of the input, Anyone else get it to work?
rl ·
to make it work I had to insert a PolyToPolyInt between the MidiToPoly and the GraphToPoly
BTW: a guaranteed way to see a Windows NT BSOD is to insert an analyzer somewhere without breaking the stream path to the ASIO out.
mdk ·
😀 😀 😀
Hooray. Its working. thanks to everyone for helping out.
There's a completed schematic of my version here :