TONAL MIDI GENERATION IN Singing Stream: a new feature for the open-source project The Amanuensis: Automated Songwriting and Recording

in #utopian-io6 years ago (edited)

Repository

https://github.com/to-the-sun/amanuensis

The Amanuensis is an automated songwriting and recording system aimed at ridding the process of anything left-brained, so one need never leave a creative, spontaneous and improvisational state of mind, from the inception of the song until its final master. The program will construct a cohesive song structure, using the best of what you give it, looping around you and growing in real-time as you play. All you have to do is jam and fully written songs will flow out behind you wherever you go.

If you're interested in trying it out, please get a hold of me! Playtesters wanted!

New Features

  • What feature(s) did you add?

Singing Stream is an abstraction that pops up automatically when The Amanuensis is loaded. Its function is to turn a stream of data into MIDI notes which can be utilized by the program. One potential source is a stream of audio, however previously the MIDI produced was simply triggered by amplitude; its pitch was static and had to be specified in advance. Now, with the help of MIDIguitar, a tonal analysis takes place and the pitch of the MIDI produced will follow that of your instrument, voice, etc.

MIDIguitar had previously been integrated into the main window, but its use was cumbersome and restricted to one audio channel at time. Now it is integrated directly and cleanly into the place where all the other MIDI is produced, the pitch and velocity of the MIDI is displayed prominently, and its UI window can be opened for access to more options.

In a related update, the pitch of the MIDI created by each device through Singing Stream is no longer restricted to a single octave. It had become apparent that this was necessary, given that all of the hotkeys lie in the very lowest octave (where otherwise it would be unlikely to be playing), meaning that an external game controller for example, could not have buttons relegated to hotkeys and be played at the same time.

  • How did you implement it/them?

If you're not familiar, Max is a visual language and textual representations like those shown for each commit on Github aren't particularly comprehensible to humans. You won't find any of the commenting there either. Therefore, I will do my best to present the work done in images instead.

These are the primary commits involved:

The main change in this commit was in altering the random 11 object into a pair of objects that, when initializing the pitch value, limit it to the full MIDI range minus the hotkey range. Other minor changes were made where the notes are actually generated, but are no longer extant, as that portion of code was completely reworked (see following commits).


the initialize_pitchsubpatcher in singingstream.maxpat

The tonal_midisubpatcher was created in audio_stream, utilizing the audio source it acquires. This loads an instance of MIDIguitar for that stream when appropriate and disables it otherwise. Prior to this, a largely-failed implementation of pitch detection using sigmund~ had been in place that almost never worked and basically rendered the pitch generated by audio streams meaningless.

the tonal_midisubpatcher found in audio_stream

The MIDI generated in tonal_midibypasses the usual route and sends it directly through s ---singing_midi. It was therefore necessary to turn off the atonal MIDI generation when it's in use. The pitch/instrumentsubpatcher was renovated to do this and simplified overall.

After the check for atonality, all that is necessary is to retrieve the instrument (or "device") name and then store the pitch for the sake of using append_channel. This brings the patcher in line with the way the rest of the system assigns MIDI channels. Previously pitch had to be calculated by taking octave into account and the functionality of append_channelwas strewn all over in a generally inconcise way.


the MIDIformatpatch and its subpatcher channel/instrumentwere both almost completely renovated (polysingingstream.maxpat)

It was also necessary to initialize a new parameter, "tonal", for each stream with a default value of 0.


the section of code in p initializethat handles "tonal" (singingstream.maxpat)

Finally, a new UI element was needed to handle the selection between the two methods of generating MIDI. p tonalwas created for that purpose and connected to a button on the main UI of singingstream.maxpat.


most of p tonalwas created in this commit, the rest in following commits

The finishing touches were put on the UI, in order that pitch and velocity could be displayed in the most informational way possible. The now defunct octave and channel controls were removed, velocity was moved up directly below pitch and pitch was set to update dynamically when tonal. When set to generate MIDI "atonally", the pitch reverts to a static parameter that can be set by the user (and bold size 12 font).


bars beneath the text change size with the changing information so it is very easy to see.

GitHub Account

https://github.com/to-the-sun

Sort:  

Thanks for the contribution, @to-the-sun!


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Just curious, why are these getting scored lower? I probably put the most work into them of all so far.

Because none of us use the language you are using, or would use the program you are creating, so it's incredibly hard for us to judge if this is the case and make sure the score is accurate.

Gotcha. Not the first time I've found a lack of peers straddling the boundary between music and code.

Hey @to-the-sun
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.033
BTC 64513.89
ETH 3155.04
USDT 1.00
SBD 4.00